Chromium Code Reviews| 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" | |
| 8 #include "base/logging.h" | |
| 9 #include "base/prefs/pref_service.h" | |
| 10 #include "base/process/kill.h" | |
| 11 #include "base/win/windows_version.h" | |
| 12 #include "chrome/browser/browser_process.h" | |
| 13 #include "chrome/browser/chrome_notification_types.h" | |
| 14 #include "chrome/browser/first_run/upgrade_util.h" | |
| 15 #include "chrome/browser/first_run/upgrade_util_win.h" | |
| 16 #include "chrome/browser/lifetime/application_lifetime.h" | |
| 17 #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h " | |
| 18 #include "chrome/common/chrome_switches.h" | |
| 19 #include "chrome/common/pref_names.h" | |
| 20 #include "content/public/browser/notification_service.h" | |
| 21 | |
| 22 #include "ui/aura/remote_window_tree_host_win.h" | |
| 23 #include "ui/base/ui_base_switches.h" | |
| 24 | |
| 25 BrowserProcessPlatformPart::BrowserProcessPlatformPart() { | 7 BrowserProcessPlatformPart::BrowserProcessPlatformPart() { |
| 26 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
| 27 // Tell metro viewer to close when we are shutting down. | |
| 28 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | |
| 29 content::NotificationService::AllSources()); | |
| 30 } | |
| 31 } | 8 } |
| 32 | 9 |
| 33 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 10 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
| 34 } | 11 } |
| 35 | 12 |
| 36 void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() { | |
| 37 metro_viewer_process_host_.reset(NULL); | |
| 38 } | |
| 39 | |
| 40 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( | 13 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( |
|
sky
2016/01/14 15:50:09
Seems like this class no longer has any content. C
scottmg
2016/01/14 18:20:47
Ah, I thought it needed a stub, but there's a comm
| |
| 41 const base::CommandLine& command_line) { | 14 const base::CommandLine& command_line) { |
| 42 // Check for Windows 8 specific commandlines requesting that this process | |
| 43 // either connect to an existing viewer or launch a new viewer and | |
| 44 // synchronously wait for it to connect. | |
| 45 | |
| 46 bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId); | |
| 47 bool connect = (launch || | |
| 48 (command_line.HasSwitch(switches::kViewerConnect) && | |
| 49 !metro_viewer_process_host_.get())); | |
| 50 if (!connect) | |
| 51 return; | |
| 52 // Create a host to connect to the Metro viewer process over IPC. | |
| 53 metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost()); | |
| 54 if (launch) { | |
| 55 CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection( | |
| 56 command_line.GetSwitchValueNative( | |
| 57 switches::kViewerLaunchViaAppId))); | |
| 58 } | |
| 59 } | 15 } |
| 60 | 16 |
| 61 void BrowserProcessPlatformPart::Observe( | 17 void BrowserProcessPlatformPart::Observe( |
| 62 int type, | 18 int type, |
| 63 const content::NotificationSource& source, | 19 const content::NotificationSource& source, |
| 64 const content::NotificationDetails& details) { | 20 const content::NotificationDetails& details) { |
| 65 | |
| 66 DCHECK(type == chrome::NOTIFICATION_APP_TERMINATING); | |
| 67 PrefService* pref_service = g_browser_process->local_state(); | |
| 68 bool is_relaunch = pref_service->GetBoolean(prefs::kWasRestarted); | |
| 69 if (is_relaunch) { | |
| 70 // TODO(scottmg): A lot of this can be removed http://crbug.com/558054. | |
| 71 } | |
| 72 } | 21 } |
| OLD | NEW |