blob: 093b57b932b09fd086d9378612480782c9d9b338 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <windows.applicationmodel.core.h>
#include <>
#include <windows.ui.core.h>
#include "winrt_utils.h"
// This class handles the various flavors of URL launches in metro, i.e.
// via the search charm, via a url being navigated from a metro app, etc.
class ChromeUrlLaunchHandler {
HRESULT Initialize();
// If metro chrome was launched due to a URL navigation/search request then
// the navigation should be done when the frame window is initialized. This
// function is called to complete the pending navigation when we receive a
// notification from chrome that the frame window is initialized.
void PerformPendingNavigation();
void Activate(winapp::Activation::IActivatedEventArgs* args);
// Invoked when we receive search notifications in metro chrome.
template<class T> void HandleSearchRequest(T* args);
HRESULT OnQuerySubmitted(
winapp::Search::ISearchPane* search_pane,
winapp::Search::ISearchPaneQuerySubmittedEventArgs* args);
base::string16 GetUrlFromLaunchArgs(const base::string16& launch_args);
// Invoked when a url is navigated from a metro app or in the metro
// shelf.
void HandleProtocolLaunch(
winapp::Activation::IProtocolActivatedEventArgs* args);
// Invoked when the app is launched normally
void HandleLaunch(winapp::Activation::ILaunchActivatedEventArgs* args);
// Helper function to initiate a navigation or search request in chrome.
void InitiateNavigationOrSearchRequest(const wchar_t* url,
const wchar_t* search_string);
Microsoft::WRL::ComPtr<winapp::Search::ISearchPane> search_pane_;
EventRegistrationToken query_submitted_token_;