| 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/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/views/aura/app_list/app_list_model_builder.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_view_delegate.h" | 16 #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h" |
| 17 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" | 17 #include "chrome/browser/ui/views/aura/status_area_host_aura.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 | 21 |
| 22 #if defined(OS_CHROMEOS) |
| 23 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 24 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 25 #endif |
| 22 namespace { | 26 namespace { |
| 23 | 27 |
| 24 // Returns a list of Aura windows from a BrowserList, using either a | 28 // Returns a list of Aura windows from a BrowserList, using either a |
| 25 // const_iterator or const_reverse_iterator. | 29 // const_iterator or const_reverse_iterator. |
| 26 template<typename IT> | 30 template<typename IT> |
| 27 std::vector<aura::Window*> GetTabbedBrowserWindows(IT begin, IT end) { | 31 std::vector<aura::Window*> GetTabbedBrowserWindows(IT begin, IT end) { |
| 28 std::vector<aura::Window*> windows; | 32 std::vector<aura::Window*> windows; |
| 29 for (IT it = begin; it != end; ++it) { | 33 for (IT it = begin; it != end; ++it) { |
| 30 Browser* browser = *it; | 34 Browser* browser = *it; |
| 31 if (browser && | 35 if (browser && |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Browser::OpenEmptyWindow(profile); | 85 Browser::OpenEmptyWindow(profile); |
| 82 } | 86 } |
| 83 | 87 |
| 84 views::Widget* ChromeShellDelegate::CreateStatusArea() { | 88 views::Widget* ChromeShellDelegate::CreateStatusArea() { |
| 85 status_area_host_.reset(new StatusAreaHostAura()); | 89 status_area_host_.reset(new StatusAreaHostAura()); |
| 86 views::Widget* status_area_widget = | 90 views::Widget* status_area_widget = |
| 87 status_area_host_.get()->CreateStatusArea(); | 91 status_area_host_.get()->CreateStatusArea(); |
| 88 return status_area_widget; | 92 return status_area_widget; |
| 89 } | 93 } |
| 90 | 94 |
| 95 #if defined(OS_CHROMEOS) |
| 96 void ChromeShellDelegate::LockScreen() { |
| 97 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 98 NotifyScreenLockRequested(); |
| 99 } |
| 100 #endif |
| 101 |
| 91 void ChromeShellDelegate::BuildAppListModel(ash::AppListModel* model) { | 102 void ChromeShellDelegate::BuildAppListModel(ash::AppListModel* model) { |
| 92 AppListModelBuilder builder(ProfileManager::GetDefaultProfile(), | 103 AppListModelBuilder builder(ProfileManager::GetDefaultProfile(), |
| 93 model); | 104 model); |
| 94 builder.Build(); | 105 builder.Build(); |
| 95 } | 106 } |
| 96 | 107 |
| 97 ash::AppListViewDelegate* | 108 ash::AppListViewDelegate* |
| 98 ChromeShellDelegate::CreateAppListViewDelegate() { | 109 ChromeShellDelegate::CreateAppListViewDelegate() { |
| 99 // Shell will own the created delegate. | 110 // Shell will own the created delegate. |
| 100 return new AppListViewDelegate; | 111 return new AppListViewDelegate; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 bool ChromeShellDelegate::ConfigureLauncherItem( | 141 bool ChromeShellDelegate::ConfigureLauncherItem( |
| 131 ash::LauncherItem* item) { | 142 ash::LauncherItem* item) { |
| 132 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); | 143 BrowserView* view = BrowserView::GetBrowserViewForNativeWindow(item->window); |
| 133 return view && | 144 return view && |
| 134 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); | 145 ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); |
| 135 } | 146 } |
| 136 | 147 |
| 137 int ChromeShellDelegate::GetBrowserShortcutResourceId() { | 148 int ChromeShellDelegate::GetBrowserShortcutResourceId() { |
| 138 return IDR_PRODUCT_LOGO_32; | 149 return IDR_PRODUCT_LOGO_32; |
| 139 } | 150 } |
| OLD | NEW |