OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser_process_platform_part_aurawin.h" | 5 #include "chrome/browser/browser_process_platform_part_aurawin.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() { | 35 void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() { |
36 metro_viewer_process_host_.reset(NULL); | 36 metro_viewer_process_host_.reset(NULL); |
37 } | 37 } |
38 | 38 |
39 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( | 39 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( |
40 const CommandLine& command_line) { | 40 const CommandLine& command_line) { |
41 // Check for Windows 8 specific commandlines requesting that this process | 41 // Check for Windows 8 specific commandlines requesting that this process |
42 // either connect to an existing viewer or launch a new viewer and | 42 // either connect to an existing viewer or launch a new viewer and |
43 // synchronously wait for it to connect. | 43 // synchronously wait for it to connect. |
44 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 44 bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId); |
45 bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId); | 45 bool connect = (launch || |
46 bool connect = (launch || | 46 (command_line.HasSwitch(switches::kViewerConnect) && |
47 (command_line.HasSwitch(switches::kViewerConnect) && | 47 !metro_viewer_process_host_.get())); |
48 !metro_viewer_process_host_.get())); | 48 if (!connect) |
49 if (connect) { | 49 return; |
50 // Create a host to connect to the Metro viewer process over IPC. | 50 // Create a host to connect to the Metro viewer process over IPC. |
51 metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost()); | 51 metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost()); |
52 if (launch) { | 52 if (launch) { |
53 CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection( | 53 CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection( |
sky
2014/04/14 13:55:17
We're not going to use the metro viewer code for t
cpu_(ooo_6.6-7.5)
2014/04/14 20:02:06
The current plan includes the viewer process in me
| |
54 command_line.GetSwitchValueNative( | 54 command_line.GetSwitchValueNative( |
55 switches::kViewerLaunchViaAppId))); | 55 switches::kViewerLaunchViaAppId))); |
56 } | |
57 } | |
58 } | 56 } |
59 } | 57 } |
60 | 58 |
61 void BrowserProcessPlatformPart::Observe( | 59 void BrowserProcessPlatformPart::Observe( |
62 int type, | 60 int type, |
63 const content::NotificationSource& source, | 61 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) { | 62 const content::NotificationDetails& details) { |
65 | 63 |
66 DCHECK(type == chrome::NOTIFICATION_APP_TERMINATING); | 64 DCHECK(type == chrome::NOTIFICATION_APP_TERMINATING); |
67 PrefService* pref_service = g_browser_process->local_state(); | 65 PrefService* pref_service = g_browser_process->local_state(); |
68 bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted); | 66 bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted); |
69 if (is_relaunch) { | 67 if (is_relaunch) { |
70 upgrade_util::RelaunchMode mode = | 68 upgrade_util::RelaunchMode mode = |
71 upgrade_util::RelaunchModeStringToEnum( | 69 upgrade_util::RelaunchModeStringToEnum( |
72 pref_service->GetString(prefs::kRelaunchMode)); | 70 pref_service->GetString(prefs::kRelaunchMode)); |
73 if (metro_viewer_process_host_.get()) { | 71 if (metro_viewer_process_host_.get()) { |
74 if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP) { | 72 if (mode == upgrade_util::RELAUNCH_MODE_DESKTOP) { |
75 // Metro -> Desktop | 73 // Metro -> Desktop |
76 chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE); | 74 chrome::ActivateDesktopHelper(chrome::ASH_TERMINATE); |
77 } else { | 75 } else { |
78 // Metro -> Metro | 76 // Metro -> Metro |
79 aura::HandleMetroExit(); | 77 aura::HandleMetroExit(); |
80 } | 78 } |
81 } | 79 } |
82 } | 80 } |
83 } | 81 } |
OLD | NEW |