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/ui/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/launcher/launcher_types.h" | 7 #include "ash/launcher/launcher_types.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "chrome/browser/chromeos/login/screen_locker.h" | 11 #include "chrome/browser/chromeos/login/screen_locker.h" |
12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" | 12 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" |
13 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/sessions/tab_restore_service.h" | 15 #include "chrome/browser/sessions/tab_restore_service.h" |
16 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 16 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
17 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" | 17 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" |
18 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" | 18 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" |
19 #include "chrome/browser/ui/ash/caps_lock_handler.h" | 19 #include "chrome/browser/ui/ash/caps_lock_handler.h" |
20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
21 #include "chrome/browser/ui/ash/user_action_handler.h" | 21 #include "chrome/browser/ui/ash/user_action_handler.h" |
22 #include "chrome/browser/ui/ash/window_positioner.h" | 22 #include "chrome/browser/ui/ash/window_positioner.h" |
23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/browser_commands.h" | 24 #include "chrome/browser/ui/browser_commands.h" |
25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
27 #include "chrome/browser/ui/views/frame/browser_view.h" | |
tfarina
2012/09/12 14:47:51
no, no, no. You can't include this anymore!
sschmitz
2012/09/12 23:45:50
Thanks. Found a better way.
Done
| |
27 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 28 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
28 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/time_format.h" | 31 #include "chrome/common/time_format.h" |
31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
34 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
35 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
36 #include "ui/aura/client/user_action_client.h" | 37 #include "ui/aura/client/user_action_client.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 chrome::NOTIFICATION_SESSION_STARTED, | 86 chrome::NOTIFICATION_SESSION_STARTED, |
86 content::NotificationService::AllSources()); | 87 content::NotificationService::AllSources()); |
87 #endif | 88 #endif |
88 } | 89 } |
89 | 90 |
90 ChromeShellDelegate::~ChromeShellDelegate() { | 91 ChromeShellDelegate::~ChromeShellDelegate() { |
91 if (instance_ == this) | 92 if (instance_ == this) |
92 instance_ = NULL; | 93 instance_ = NULL; |
93 } | 94 } |
94 | 95 |
96 void ChromeShellDelegate::RemoveFullScreenExitBubble() { | |
97 Browser* browser = GetTargetBrowser(); | |
98 if (!browser) | |
99 return; | |
100 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | |
101 if (!browser_view) | |
102 return; | |
103 browser_view->RemoveFullScreenExitBubble(); | |
104 } | |
105 | |
95 bool ChromeShellDelegate::IsUserLoggedIn() { | 106 bool ChromeShellDelegate::IsUserLoggedIn() { |
96 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
97 // When running a Chrome OS build outside of a device (i.e. on a developer's | 108 // When running a Chrome OS build outside of a device (i.e. on a developer's |
98 // workstation) and not running as login-manager, pretend like we're always | 109 // workstation) and not running as login-manager, pretend like we're always |
99 // logged in. | 110 // logged in. |
100 if (!base::chromeos::IsRunningOnChromeOS() && | 111 if (!base::chromeos::IsRunningOnChromeOS() && |
101 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { | 112 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { |
102 return true; | 113 return true; |
103 } | 114 } |
104 | 115 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 return new UserActionHandler; | 353 return new UserActionHandler; |
343 } | 354 } |
344 | 355 |
345 void ChromeShellDelegate::OpenFeedbackPage() { | 356 void ChromeShellDelegate::OpenFeedbackPage() { |
346 chrome::OpenFeedbackDialog(GetTargetBrowser()); | 357 chrome::OpenFeedbackDialog(GetTargetBrowser()); |
347 } | 358 } |
348 | 359 |
349 void ChromeShellDelegate::RecordUserMetricsAction( | 360 void ChromeShellDelegate::RecordUserMetricsAction( |
350 ash::UserMetricsAction action) { | 361 ash::UserMetricsAction action) { |
351 switch (action) { | 362 switch (action) { |
363 case ash::UMA_ACCEL_MAXIMIZE_RESTORE: | |
364 // TODO(sschmitz): Using the old name "Accel_Fullscreen_F4". Should we | |
365 // change it to Accel_Maximize_Restore_F4? | |
366 content::RecordAction(content::UserMetricsAction("Accel_Fullscreen_F4")); | |
367 break; | |
352 case ash::UMA_ACCEL_PREVWINDOW_TAB: | 368 case ash::UMA_ACCEL_PREVWINDOW_TAB: |
353 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_Tab")); | 369 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_Tab")); |
354 break; | 370 break; |
355 case ash::UMA_ACCEL_NEXTWINDOW_TAB: | 371 case ash::UMA_ACCEL_NEXTWINDOW_TAB: |
356 content::RecordAction(content::UserMetricsAction("Accel_NextWindow_Tab")); | 372 content::RecordAction(content::UserMetricsAction("Accel_NextWindow_Tab")); |
357 break; | 373 break; |
358 case ash::UMA_ACCEL_PREVWINDOW_F5: | 374 case ash::UMA_ACCEL_PREVWINDOW_F5: |
359 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_F5")); | 375 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_F5")); |
360 break; | 376 break; |
361 case ash::UMA_ACCEL_NEXTWINDOW_F5: | 377 case ash::UMA_ACCEL_NEXTWINDOW_F5: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 ash::Shell::GetInstance()->ShowLauncher(); | 433 ash::Shell::GetInstance()->ShowLauncher(); |
418 break; | 434 break; |
419 default: | 435 default: |
420 NOTREACHED() << "Unexpected notification " << type; | 436 NOTREACHED() << "Unexpected notification " << type; |
421 } | 437 } |
422 #else | 438 #else |
423 // MSVC++ warns about switch statements without any cases. | 439 // MSVC++ warns about switch statements without any cases. |
424 NOTREACHED() << "Unexpected notification " << type; | 440 NOTREACHED() << "Unexpected notification " << type; |
425 #endif | 441 #endif |
426 } | 442 } |
OLD | NEW |