summaryrefslogtreecommitdiffstats
path: root/base/win
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-22 21:42:29 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-22 21:42:29 +0000
commitf394bc63a63b5e30448c06d77d1019f933fe8890 (patch)
tree0fe00bbe8716440ebad299d40ae6bc7ffc6ef224 /base/win
parentab64a08647d7fb1189989d33b4c107c1950e471d (diff)
downloadchromium_src-f394bc63a63b5e30448c06d77d1019f933fe8890.zip
chromium_src-f394bc63a63b5e30448c06d77d1019f933fe8890.tar.gz
chromium_src-f394bc63a63b5e30448c06d77d1019f933fe8890.tar.bz2
Implement forwarding of search queries for metro mode
If chrome is the default browser, launch from the search charm does not use the delegate_execute so if desktop chrome is running, metro chrome needs to forward the search string and quickly quite The source of complexity here is that to form the full url, chrome needs to access the profile which cannot be done from the metro chrome since the desktop chrome has the profile locked. Instead we leveage the kMetroNavigationAndSearchMessage from the singleton code. BUG=141032 TEST= see bug Review URL: https://chromiumcodereview.appspot.com/10824387 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r--base/win/metro.cc36
-rw-r--r--base/win/metro.h17
2 files changed, 47 insertions, 6 deletions
diff --git a/base/win/metro.cc b/base/win/metro.cc
index c806f62..6cc8a85 100644
--- a/base/win/metro.cc
+++ b/base/win/metro.cc
@@ -124,5 +124,41 @@ bool IsParentalControlActivityLoggingOn() {
return parental_control_logging_required;
}
+// Metro driver exports for getting the launch type, initial url, initial
+// search term, etc.
+extern "C" {
+typedef const wchar_t* (*GetInitialUrl)();
+typedef const wchar_t* (*GetInitialSearchString)();
+typedef base::win::MetroLaunchType (*GetLaunchType)(
+ base::win::MetroPreviousExecutionState* previous_state);
+}
+
+MetroLaunchType GetMetroLaunchParams(string16* params) {
+ HMODULE metro = base::win::GetMetroModule();
+ if (!metro)
+ return base::win::METRO_LAUNCH_ERROR;
+
+ GetLaunchType get_launch_type = reinterpret_cast<GetLaunchType>(
+ ::GetProcAddress(metro, "GetLaunchType"));
+ DCHECK(get_launch_type);
+
+ base::win::MetroLaunchType launch_type = get_launch_type(NULL);
+
+ if ((launch_type == base::win::METRO_PROTOCOL) ||
+ (launch_type == base::win::METRO_LAUNCH)) {
+ GetInitialUrl initial_metro_url = reinterpret_cast<GetInitialUrl>(
+ ::GetProcAddress(metro, "GetInitialUrl"));
+ DCHECK(initial_metro_url);
+ *params = initial_metro_url();
+ } else if (launch_type == base::win::METRO_SEARCH) {
+ GetInitialSearchString initial_search_string =
+ reinterpret_cast<GetInitialSearchString>(
+ ::GetProcAddress(metro, "GetInitialSearchString"));
+ DCHECK(initial_search_string);
+ *params = initial_search_string();
+ }
+ return launch_type;
+}
+
} // namespace win
} // namespace base
diff --git a/base/win/metro.h b/base/win/metro.h
index 9083388..a500174 100644
--- a/base/win/metro.h
+++ b/base/win/metro.h
@@ -16,12 +16,13 @@ namespace win {
// Identifies the type of the metro launch.
enum MetroLaunchType {
- LAUNCH,
- SEARCH,
- SHARE,
- FILE,
- PROTOCOL,
- LASTLAUNCHTYPE,
+ METRO_LAUNCH,
+ METRO_SEARCH,
+ METRO_SHARE,
+ METRO_FILE,
+ METRO_PROTOCOL,
+ METRO_LAUNCH_ERROR,
+ METRO_LASTLAUNCHTYPE,
};
// In metro mode, this enum identifies the last execution state, i.e. whether
@@ -71,6 +72,10 @@ BASE_EXPORT bool IsTouchEnabled();
// This function should ideally be called on the UI thread.
BASE_EXPORT bool IsParentalControlActivityLoggingOn();
+// Returns the type of launch and the activation params. For example if the
+// the launch is for METRO_PROTOCOL then the params is a url.
+BASE_EXPORT MetroLaunchType GetMetroLaunchParams(string16* params);
+
// Handler function for the buttons on a metro dialog box
typedef void (*MetroDialogButtonPressedHandler)();