| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/win/metro.h" | 5 #include "base/win/metro.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/win/scoped_comptr.h" | 9 #include "base/win/scoped_comptr.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return false; | 117 return false; |
| 118 | 118 |
| 119 unsigned long restrictions = 0; | 119 unsigned long restrictions = 0; |
| 120 settings->GetRestrictions(&restrictions); | 120 settings->GetRestrictions(&restrictions); |
| 121 | 121 |
| 122 parental_control_logging_required = | 122 parental_control_logging_required = |
| 123 (restrictions & WPCFLAG_LOGGING_REQUIRED) == WPCFLAG_LOGGING_REQUIRED; | 123 (restrictions & WPCFLAG_LOGGING_REQUIRED) == WPCFLAG_LOGGING_REQUIRED; |
| 124 return parental_control_logging_required; | 124 return parental_control_logging_required; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Metro driver exports for getting the launch type, initial url, initial |
| 128 // search term, etc. |
| 129 extern "C" { |
| 130 typedef const wchar_t* (*GetInitialUrl)(); |
| 131 typedef const wchar_t* (*GetInitialSearchString)(); |
| 132 typedef base::win::MetroLaunchType (*GetLaunchType)( |
| 133 base::win::MetroPreviousExecutionState* previous_state); |
| 134 } |
| 135 |
| 136 MetroLaunchType GetMetroLaunchParams(string16* params) { |
| 137 HMODULE metro = base::win::GetMetroModule(); |
| 138 if (!metro) |
| 139 return base::win::METRO_LAUNCH_ERROR; |
| 140 |
| 141 GetLaunchType get_launch_type = reinterpret_cast<GetLaunchType>( |
| 142 ::GetProcAddress(metro, "GetLaunchType")); |
| 143 DCHECK(get_launch_type); |
| 144 |
| 145 base::win::MetroLaunchType launch_type = get_launch_type(NULL); |
| 146 |
| 147 if ((launch_type == base::win::METRO_PROTOCOL) || |
| 148 (launch_type == base::win::METRO_LAUNCH)) { |
| 149 GetInitialUrl initial_metro_url = reinterpret_cast<GetInitialUrl>( |
| 150 ::GetProcAddress(metro, "GetInitialUrl")); |
| 151 DCHECK(initial_metro_url); |
| 152 *params = initial_metro_url(); |
| 153 } else if (launch_type == base::win::METRO_SEARCH) { |
| 154 GetInitialSearchString initial_search_string = |
| 155 reinterpret_cast<GetInitialSearchString>( |
| 156 ::GetProcAddress(metro, "GetInitialSearchString")); |
| 157 DCHECK(initial_search_string); |
| 158 *params = initial_search_string(); |
| 159 } |
| 160 return launch_type; |
| 161 } |
| 162 |
| 127 } // namespace win | 163 } // namespace win |
| 128 } // namespace base | 164 } // namespace base |
| OLD | NEW |