| 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 "chrome/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "base/win/metro.h" | 17 #include "base/win/metro.h" |
| 18 #include "base/win/scoped_com_initializer.h" | 18 #include "base/win/scoped_com_initializer.h" |
| 19 #include "base/win/scoped_comptr.h" | 19 #include "base/win/scoped_comptr.h" |
| 20 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 21 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 22 #include "base/win/wrapped_window_proc.h" | 22 #include "base/win/wrapped_window_proc.h" |
| 23 #include "chrome/browser/ui/simple_message_box.h" | 23 #include "chrome/browser/ui/simple_message_box.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/installer/util/browser_distribution.h" | 25 #include "chrome/installer/util/browser_distribution.h" |
| 26 #include "chrome/installer/util/install_util.h" |
| 26 #include "chrome/installer/util/shell_util.h" | 27 #include "chrome/installer/util/shell_util.h" |
| 27 #include "chrome/installer/util/wmi.h" | 28 #include "chrome/installer/util/wmi.h" |
| 28 #include "content/public/common/result_codes.h" | 29 #include "content/public/common/result_codes.h" |
| 29 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 31 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 33 #include "ui/base/win/hwnd_util.h" | 34 #include "ui/base/win/hwnd_util.h" |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return false; | 127 return false; |
| 127 } | 128 } |
| 128 | 129 |
| 129 bool ActivateMetroChrome() { | 130 bool ActivateMetroChrome() { |
| 130 FilePath chrome_exe; | 131 FilePath chrome_exe; |
| 131 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 132 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 132 NOTREACHED() << "Failed to get chrome exe path"; | 133 NOTREACHED() << "Failed to get chrome exe path"; |
| 133 return false; | 134 return false; |
| 134 } | 135 } |
| 135 string16 app_id = ShellUtil::GetBrowserModelId( | 136 string16 app_id = ShellUtil::GetBrowserModelId( |
| 136 BrowserDistribution::GetDistribution(), chrome_exe.value()); | 137 BrowserDistribution::GetDistribution(), |
| 138 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())); |
| 137 if (app_id.empty()) { | 139 if (app_id.empty()) { |
| 138 NOTREACHED() << "Failed to get chrome app user model id."; | 140 NOTREACHED() << "Failed to get chrome app user model id."; |
| 139 return false; | 141 return false; |
| 140 } | 142 } |
| 141 | 143 |
| 142 base::win::ScopedComPtr<IApplicationActivationManager> activation_manager; | 144 base::win::ScopedComPtr<IApplicationActivationManager> activation_manager; |
| 143 HRESULT hr = activation_manager.CreateInstance( | 145 HRESULT hr = activation_manager.CreateInstance( |
| 144 CLSID_ApplicationActivationManager); | 146 CLSID_ApplicationActivationManager); |
| 145 if (!activation_manager) { | 147 if (!activation_manager) { |
| 146 NOTREACHED() << "Failed to cocreate activation manager. Error: " << hr; | 148 NOTREACHED() << "Failed to cocreate activation manager. Error: " << hr; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 switch (message) { | 452 switch (message) { |
| 451 case WM_COPYDATA: | 453 case WM_COPYDATA: |
| 452 return OnCopyData(reinterpret_cast<HWND>(wparam), | 454 return OnCopyData(reinterpret_cast<HWND>(wparam), |
| 453 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 455 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
| 454 default: | 456 default: |
| 455 break; | 457 break; |
| 456 } | 458 } |
| 457 | 459 |
| 458 return ::DefWindowProc(hwnd, message, wparam, lparam); | 460 return ::DefWindowProc(hwnd, message, wparam, lparam); |
| 459 } | 461 } |
| OLD | NEW |