Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/ui/views/aura/chrome_shell_delegate.cc

Issue 9570044: Rename chrome/browser/ui/views/{aura => ash}/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
6
7 #include "ash/launcher/launcher_types.h"
8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/wm/partial_screenshot_view.h"
10 #include "ash/wm/window_util.h"
11 #include "base/command_line.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/views/aura/app_list/app_list_view_delegate.h"
15 #include "chrome/browser/ui/views/aura/launcher/chrome_launcher_delegate.h"
16 #include "chrome/browser/ui/views/aura/status_area_host_aura.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h"
18 #include "chrome/common/chrome_switches.h"
19 #include "ui/aura/window.h"
20
21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
23 #include "chrome/browser/chromeos/dbus/power_manager_client.h"
24 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
25 #endif
26 namespace {
27
28 // Returns a list of Aura windows from a BrowserList, using either a
29 // const_iterator or const_reverse_iterator.
30 template<typename IT>
31 std::vector<aura::Window*> GetBrowserWindows(IT begin, IT end) {
32 std::vector<aura::Window*> windows;
33 for (IT it = begin; it != end; ++it) {
34 Browser* browser = *it;
35 if (browser && browser->window()->GetNativeHandle())
36 windows.push_back(browser->window()->GetNativeHandle());
37 }
38 return windows;
39 }
40
41 } // namespace
42
43 // static
44 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL;
45
46 ChromeShellDelegate::ChromeShellDelegate() {
47 instance_ = this;
48 }
49
50 ChromeShellDelegate::~ChromeShellDelegate() {
51 if (instance_ == this)
52 instance_ = NULL;
53 }
54
55 StatusAreaView* ChromeShellDelegate::GetStatusArea() {
56 return status_area_host_->GetStatusArea();
57 }
58
59 views::Widget* ChromeShellDelegate::CreateStatusArea() {
60 status_area_host_.reset(new StatusAreaHostAura());
61 views::Widget* status_area_widget =
62 status_area_host_.get()->CreateStatusArea();
63 return status_area_widget;
64 }
65
66 #if defined(OS_CHROMEOS)
67 void ChromeShellDelegate::LockScreen() {
68 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
69 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
70 NotifyScreenLockRequested();
71 }
72 }
73 #endif
74
75 void ChromeShellDelegate::Exit() {
76 BrowserList::AttemptUserExit();
77 }
78
79 ash::AppListViewDelegate*
80 ChromeShellDelegate::CreateAppListViewDelegate() {
81 // Shell will own the created delegate.
82 return new AppListViewDelegate;
83 }
84
85 std::vector<aura::Window*> ChromeShellDelegate::GetCycleWindowList(
86 CycleSource source,
87 CycleOrder order) const {
88 std::vector<aura::Window*> windows;
89 switch (order) {
90 case ORDER_MRU:
91 // BrowserList maintains a list of browsers sorted by activity.
92 windows = GetBrowserWindows(BrowserList::begin_last_active(),
93 BrowserList::end_last_active());
94 break;
95 case ORDER_LINEAR:
96 // Just return windows in creation order.
97 windows = GetBrowserWindows(BrowserList::begin(),
98 BrowserList::end());
99 break;
100 default:
101 NOTREACHED();
102 break;
103 }
104 return windows;
105 }
106
107 void ChromeShellDelegate::StartPartialScreenshot(
108 ash::ScreenshotDelegate* screenshot_delegate) {
109 ash::PartialScreenshotView::StartPartialScreenshot(screenshot_delegate);
110 }
111
112 ash::LauncherDelegate* ChromeShellDelegate::CreateLauncherDelegate(
113 ash::LauncherModel* model) {
114 ChromeLauncherDelegate* delegate = new ChromeLauncherDelegate(NULL, model);
115 delegate->Init();
116 return delegate;
117 }
118
119 ash::SystemTrayDelegate* ChromeShellDelegate::CreateSystemTrayDelegate(
120 ash::SystemTray* tray) {
121 #if defined(OS_CHROMEOS)
122 return chromeos::CreateSystemTrayDelegate(tray);
123 #else
124 return NULL;
125 #endif
126 }
127
128 bool ChromeShellDelegate::GetOverrideWindowMode(
129 ash::Shell::WindowMode* window_mode) {
130 return false;
131 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/chrome_shell_delegate.h ('k') | chrome/browser/ui/views/aura/ime_controller_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698