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/fullscreen/fullscreen_controller.h" |
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 return new UserActionHandler; | 343 return new UserActionHandler; |
343 } | 344 } |
344 | 345 |
345 void ChromeShellDelegate::OpenFeedbackPage() { | 346 void ChromeShellDelegate::OpenFeedbackPage() { |
346 chrome::OpenFeedbackDialog(GetTargetBrowser()); | 347 chrome::OpenFeedbackDialog(GetTargetBrowser()); |
347 } | 348 } |
348 | 349 |
349 void ChromeShellDelegate::RecordUserMetricsAction( | 350 void ChromeShellDelegate::RecordUserMetricsAction( |
350 ash::UserMetricsAction action) { | 351 ash::UserMetricsAction action) { |
351 switch (action) { | 352 switch (action) { |
| 353 case ash::UMA_ACCEL_MAXIMIZE_RESTORE: |
| 354 content::RecordAction( |
| 355 content::UserMetricsAction("Accel_Maximize_Restore_F4")); |
| 356 break; |
352 case ash::UMA_ACCEL_PREVWINDOW_TAB: | 357 case ash::UMA_ACCEL_PREVWINDOW_TAB: |
353 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_Tab")); | 358 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_Tab")); |
354 break; | 359 break; |
355 case ash::UMA_ACCEL_NEXTWINDOW_TAB: | 360 case ash::UMA_ACCEL_NEXTWINDOW_TAB: |
356 content::RecordAction(content::UserMetricsAction("Accel_NextWindow_Tab")); | 361 content::RecordAction(content::UserMetricsAction("Accel_NextWindow_Tab")); |
357 break; | 362 break; |
358 case ash::UMA_ACCEL_PREVWINDOW_F5: | 363 case ash::UMA_ACCEL_PREVWINDOW_F5: |
359 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_F5")); | 364 content::RecordAction(content::UserMetricsAction("Accel_PrevWindow_F5")); |
360 break; | 365 break; |
361 case ash::UMA_ACCEL_NEXTWINDOW_F5: | 366 case ash::UMA_ACCEL_NEXTWINDOW_F5: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 void ChromeShellDelegate::HandleMediaPrevTrack() { | 403 void ChromeShellDelegate::HandleMediaPrevTrack() { |
399 #if defined(OS_CHROMEOS) | 404 #if defined(OS_CHROMEOS) |
400 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPrevTrack(); | 405 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPrevTrack(); |
401 #endif | 406 #endif |
402 } | 407 } |
403 | 408 |
404 string16 ChromeShellDelegate::GetTimeRemainingString(base::TimeDelta delta) { | 409 string16 ChromeShellDelegate::GetTimeRemainingString(base::TimeDelta delta) { |
405 return TimeFormat::TimeRemaining(delta); | 410 return TimeFormat::TimeRemaining(delta); |
406 } | 411 } |
407 | 412 |
| 413 void ChromeShellDelegate::ToggleFullscreenMode() { |
| 414 Browser* browser = GetTargetBrowser(); |
| 415 if (!browser) |
| 416 return; |
| 417 FullscreenController* fullscreen_controller = |
| 418 browser->fullscreen_controller(); |
| 419 if (!fullscreen_controller) |
| 420 return; |
| 421 fullscreen_controller->ToggleFullscreenMode(); |
| 422 } |
| 423 |
408 void ChromeShellDelegate::Observe(int type, | 424 void ChromeShellDelegate::Observe(int type, |
409 const content::NotificationSource& source, | 425 const content::NotificationSource& source, |
410 const content::NotificationDetails& details) { | 426 const content::NotificationDetails& details) { |
411 #if defined(OS_CHROMEOS) | 427 #if defined(OS_CHROMEOS) |
412 switch (type) { | 428 switch (type) { |
413 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: | 429 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: |
414 ash::Shell::GetInstance()->CreateLauncher(); | 430 ash::Shell::GetInstance()->CreateLauncher(); |
415 break; | 431 break; |
416 case chrome::NOTIFICATION_SESSION_STARTED: | 432 case chrome::NOTIFICATION_SESSION_STARTED: |
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 |