| 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/views/aura/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_types.h" | 7 #include "ash/launcher/launcher_types.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 10 #include "chrome/browser/defaults.h" | 11 #include "chrome/browser/defaults.h" |
| 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/views/aura/app_list/app_list_model_builder.h" | 16 #include "chrome/browser/ui/views/aura/app_list/app_list_model_builder.h" |
| 16 #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h" | 17 #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h" |
| 17 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" | 18 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" |
| 18 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" | 19 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" |
| 19 #include "chrome/browser/ui/views/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 windows = GetTabbedBrowserWindows(BrowserList::begin(), | 105 windows = GetTabbedBrowserWindows(BrowserList::begin(), |
| 105 BrowserList::end()); | 106 BrowserList::end()); |
| 106 break; | 107 break; |
| 107 default: | 108 default: |
| 108 NOTREACHED(); | 109 NOTREACHED(); |
| 109 break; | 110 break; |
| 110 } | 111 } |
| 111 return windows; | 112 return windows; |
| 112 } | 113 } |
| 113 | 114 |
| 115 void ChromeShellDelegate::RotateFocus(bool forward) { |
| 116 if (!forward) { |
| 117 StatusAreaView* status_area = |
| 118 ChromeShellDelegate::instance()->GetStatusArea(); |
| 119 if (status_area->SetPaneFocusAndFocusDefault()) { |
| 120 status_area->GetWidget()->Activate(); |
| 121 return; |
| 122 } |
| 123 // If we can't focus the status area, fall through and focus the browser. |
| 124 } |
| 125 |
| 126 // TODO: Focus Browser |
| 127 } |
| 128 |
| 114 void ChromeShellDelegate::CreateNewWindow() { | 129 void ChromeShellDelegate::CreateNewWindow() { |
| 115 Profile* profile = ProfileManager::GetDefaultProfile(); | 130 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 116 if (browser_defaults::kAlwaysOpenIncognitoWindow && | 131 if (browser_defaults::kAlwaysOpenIncognitoWindow && |
| 117 IncognitoModePrefs::ShouldLaunchIncognito( | 132 IncognitoModePrefs::ShouldLaunchIncognito( |
| 118 *CommandLine::ForCurrentProcess(), | 133 *CommandLine::ForCurrentProcess(), |
| 119 profile->GetPrefs())) { | 134 profile->GetPrefs())) { |
| 120 profile = profile->GetOffTheRecordProfile(); | 135 profile = profile->GetOffTheRecordProfile(); |
| 121 } | 136 } |
| 122 Browser::OpenEmptyWindow(profile); | 137 Browser::OpenEmptyWindow(profile); |
| 123 } | 138 } |
| 124 | 139 |
| 125 void ChromeShellDelegate::LauncherItemClicked( | 140 void ChromeShellDelegate::LauncherItemClicked( |
| 126 const ash::LauncherItem& item) { | 141 const ash::LauncherItem& item) { |
| 127 LauncherIconUpdater::ActivateByID(item.id); | 142 LauncherIconUpdater::ActivateByID(item.id); |
| 128 } | 143 } |
| 129 | 144 |
| 130 int ChromeShellDelegate::GetBrowserShortcutResourceId() { | 145 int ChromeShellDelegate::GetBrowserShortcutResourceId() { |
| 131 return IDR_PRODUCT_LOGO_32; | 146 return IDR_PRODUCT_LOGO_32; |
| 132 } | 147 } |
| 133 | 148 |
| 134 string16 ChromeShellDelegate::GetLauncherItemTitle( | 149 string16 ChromeShellDelegate::GetLauncherItemTitle( |
| 135 const ash::LauncherItem& item) { | 150 const ash::LauncherItem& item) { |
| 136 return LauncherIconUpdater::GetTitleByID(item.id); | 151 return LauncherIconUpdater::GetTitleByID(item.id); |
| 137 } | 152 } |
| OLD | NEW |