OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_CHROME_URL_LAUNCH_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_METRO_DRIVER_CHROME_URL_LAUNCH_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <windows.applicationmodel.core.h> |
| 10 #include <Windows.applicationModel.search.h> |
| 11 #include <windows.ui.core.h> |
| 12 |
| 13 #include "winrt_utils.h" |
| 14 |
| 15 // This class handles the various flavors of URL launches in metro, i.e. |
| 16 // via the search charm, via a url being navigated from a metro app, etc. |
| 17 class ChromeUrlLaunchHandler { |
| 18 public: |
| 19 ChromeUrlLaunchHandler(); |
| 20 ~ChromeUrlLaunchHandler(); |
| 21 |
| 22 HRESULT Initialize(); |
| 23 |
| 24 // If metro chrome was launched due to a URL navigation/search request then |
| 25 // the navigation should be done when the frame window is initialized. This |
| 26 // function is called to complete the pending navigation when we receive a |
| 27 // notification from chrome that the frame window is initialized. |
| 28 void PerformPendingNavigation(); |
| 29 |
| 30 void Activate(winapp::Activation::IActivatedEventArgs* args); |
| 31 |
| 32 private: |
| 33 // Invoked when we receive search notifications in metro chrome. |
| 34 template<class T> void HandleSearchRequest(T* args); |
| 35 |
| 36 HRESULT OnQuerySubmitted( |
| 37 winapp::Search::ISearchPane* search_pane, |
| 38 winapp::Search::ISearchPaneQuerySubmittedEventArgs* args); |
| 39 |
| 40 string16 GetUrlFromLaunchArgs(const string16& launch_args); |
| 41 |
| 42 // Invoked when a url is navigated from a metro app or in the metro |
| 43 // shelf. |
| 44 void HandleProtocolLaunch( |
| 45 winapp::Activation::IProtocolActivatedEventArgs* args); |
| 46 |
| 47 // Invoked when the app is launched normally |
| 48 void HandleLaunch(winapp::Activation::ILaunchActivatedEventArgs* args); |
| 49 |
| 50 // Helper function to initiate a navigation or search request in chrome. |
| 51 void InitiateNavigationOrSearchRequest(const wchar_t* url, |
| 52 const wchar_t* search_string); |
| 53 |
| 54 Microsoft::WRL::ComPtr<winapp::Search::ISearchPane> search_pane_; |
| 55 EventRegistrationToken query_submitted_token_; |
| 56 }; |
| 57 |
| 58 #endif // CHROME_BROWSER_UI_METRO_DRIVER_CHROME_URL_LAUNCH_HANDLER_H_ |
OLD | NEW |