OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" | 5 #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_positioner.h" | 8 #include "ash/wm/window_positioner.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browser_process_platform_part_aurawin.h" | 12 #include "chrome/browser/browser_process_platform_part_aurawin.h" |
| 13 #include "chrome/browser/browser_shutdown.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/lifetime/application_lifetime.h" | 15 #include "chrome/browser/lifetime/application_lifetime.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/search_engines/util.h" | 17 #include "chrome/browser/search_engines/util.h" |
17 #include "chrome/browser/ui/ash/ash_init.h" | 18 #include "chrome/browser/ui/ash/ash_init.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
20 #include "chrome/browser/ui/browser_navigator.h" | 21 #include "chrome/browser/ui/browser_navigator.h" |
21 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/host_desktop.h" | 23 #include "chrome/browser/ui/host_desktop.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // TODO(cpu): At some point we only close the browser. Right now this | 73 // TODO(cpu): At some point we only close the browser. Right now this |
73 // is very convenient for developing. | 74 // is very convenient for developing. |
74 DLOG(INFO) << "viewer channel error : Quitting browser"; | 75 DLOG(INFO) << "viewer channel error : Quitting browser"; |
75 | 76 |
76 // Unset environment variable to let breakpad know that metro process wasn't | 77 // Unset environment variable to let breakpad know that metro process wasn't |
77 // connected. | 78 // connected. |
78 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); | 79 ::SetEnvironmentVariableA(env_vars::kMetroConnected, NULL); |
79 | 80 |
80 aura::RemoteRootWindowHostWin::Instance()->Disconnected(); | 81 aura::RemoteRootWindowHostWin::Instance()->Disconnected(); |
81 g_browser_process->ReleaseModule(); | 82 g_browser_process->ReleaseModule(); |
82 CloseOpenAshBrowsers(); | 83 |
83 chrome::CloseAsh(); | 84 // If browser is trying to quit, we shouldn't reenter the process. |
| 85 // TODO(shrikant): In general there seem to be issues with how AttemptExit |
| 86 // reentry works. In future release please clean up related code. |
| 87 if (!browser_shutdown::IsTryingToQuit()) { |
| 88 CloseOpenAshBrowsers(); |
| 89 chrome::CloseAsh(); |
| 90 } |
84 // Tell the rest of Chrome about it. | 91 // Tell the rest of Chrome about it. |
85 content::NotificationService::current()->Notify( | 92 content::NotificationService::current()->Notify( |
86 chrome::NOTIFICATION_ASH_SESSION_ENDED, | 93 chrome::NOTIFICATION_ASH_SESSION_ENDED, |
87 content::NotificationService::AllSources(), | 94 content::NotificationService::AllSources(), |
88 content::NotificationService::NoDetails()); | 95 content::NotificationService::NoDetails()); |
89 | 96 |
90 // This will delete the MetroViewerProcessHost object. Don't access member | 97 // This will delete the MetroViewerProcessHost object. Don't access member |
91 // variables/functions after this call. | 98 // variables/functions after this call. |
92 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); | 99 g_browser_process->platform_part()->OnMetroViewerProcessTerminated(); |
93 } | 100 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 OpenURL(GURL(url)); | 134 OpenURL(GURL(url)); |
128 } | 135 } |
129 | 136 |
130 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( | 137 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( |
131 const string16& search_string) { | 138 const string16& search_string) { |
132 GURL url(GetDefaultSearchURLForSearchTerms( | 139 GURL url(GetDefaultSearchURLForSearchTerms( |
133 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); | 140 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); |
134 if (url.is_valid()) | 141 if (url.is_valid()) |
135 OpenURL(url); | 142 OpenURL(url); |
136 } | 143 } |
OLD | NEW |