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

Side by Side Diff: chrome/browser/ui/views/ash/status_area_host_aura.cc

Issue 9630002: Ash: Remove compact window mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OpaqueBrowserFrameView, MultipleWindowIndicatorButton 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
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/ash/status_area_host_aura.h" 5 #include "chrome/browser/ui/views/ash/status_area_host_aura.h"
6 6
7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
9 #include "base/command_line.h" 8 #include "base/command_line.h"
10 #include "chrome/browser/chromeos/status/clock_menu_button.h" 9 #include "chrome/browser/chromeos/status/clock_menu_button.h"
11 #include "chrome/browser/chromeos/status/memory_menu_button.h" 10 #include "chrome/browser/chromeos/status/memory_menu_button.h"
12 #include "chrome/browser/chromeos/status/status_area_view.h" 11 #include "chrome/browser/chromeos/status/status_area_view.h"
13 #include "chrome/browser/defaults.h" 12 #include "chrome/browser/defaults.h"
14 #include "chrome/browser/prefs/incognito_mode_prefs.h" 13 #include "chrome/browser/prefs/incognito_mode_prefs.h"
15 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/themes/theme_service.h"
17 #include "chrome/browser/themes/theme_service_factory.h"
18 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/view_ids.h" 16 #include "chrome/browser/ui/view_ids.h"
20 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" 17 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h"
21 #include "chrome/browser/ui/views/ash/multiple_window_indicator_button.h"
22 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
24 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
25 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
26 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
27 23
28 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
29 #include "chrome/browser/chromeos/login/base_login_display_host.h" 25 #include "chrome/browser/chromeos/login/base_login_display_host.h"
30 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" 26 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
31 #include "chrome/browser/chromeos/login/screen_locker.h" 27 #include "chrome/browser/chromeos/login/screen_locker.h"
32 #include "chrome/browser/chromeos/login/user_manager.h" 28 #include "chrome/browser/chromeos/login/user_manager.h"
33 #include "chrome/browser/chromeos/status/clock_updater.h" 29 #include "chrome/browser/chromeos/status/clock_updater.h"
34 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" 30 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
35 #include "chrome/browser/chromeos/system/runtime_environment.h" 31 #include "chrome/browser/chromeos/system/runtime_environment.h"
36 #include "ui/gfx/native_widget_types.h" 32 #include "ui/gfx/native_widget_types.h"
37 #endif 33 #endif
38 34
39 namespace {
40
41 // Horizontal padding between the side of the status area and the side of the
42 // screen in compact mode.
43 const int kCompactModeHorizontalOffset = 3;
44
45 // Vertical padding between the top of the status area and the top of the screen
46 // when we're displaying either the login/lock screen or a browser window in
47 // compact mode.
48 const int kCompactModeLoginAndLockVerticalOffset = 4;
49 const int kCompactModeBrowserVerticalOffset = 2;
50
51 } // namespace
52
53 // static
54 gfx::Size StatusAreaHostAura::GetCompactModeLoginAndLockOffset() {
55 return gfx::Size(kCompactModeHorizontalOffset,
56 kCompactModeLoginAndLockVerticalOffset);
57 }
58
59 // static
60 gfx::Size StatusAreaHostAura::GetCompactModeBrowserOffset() {
61 return gfx::Size(kCompactModeHorizontalOffset,
62 kCompactModeBrowserVerticalOffset);
63 }
64
65 StatusAreaHostAura::StatusAreaHostAura() 35 StatusAreaHostAura::StatusAreaHostAura()
66 : status_area_widget_(NULL), 36 : status_area_widget_(NULL),
67 status_area_view_(NULL) { 37 status_area_view_(NULL) {
68 BrowserList::AddObserver(this); 38 BrowserList::AddObserver(this);
69 registrar_.Add(this, 39 registrar_.Add(this,
70 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 40 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
71 content::NotificationService::AllSources()); 41 content::NotificationService::AllSources());
72 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
73 registrar_.Add(this, 43 registrar_.Add(this,
74 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 44 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
(...skipping 10 matching lines...) Expand all
85 } 55 }
86 56
87 views::Widget* StatusAreaHostAura::CreateStatusArea() { 57 views::Widget* StatusAreaHostAura::CreateStatusArea() {
88 ash::Shell* shell = ash::Shell::GetInstance(); 58 ash::Shell* shell = ash::Shell::GetInstance();
89 aura::Window* status_window = shell->GetContainer( 59 aura::Window* status_window = shell->GetContainer(
90 ash::internal::kShellWindowId_StatusContainer); 60 ash::internal::kShellWindowId_StatusContainer);
91 61
92 // Create status area view. 62 // Create status area view.
93 status_area_view_ = new StatusAreaView(); 63 status_area_view_ = new StatusAreaView();
94 64
95 // Add multiple window indicator button for compact mode. Note this should be
96 // the last button added to status area so that it could be right most there.
97 if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
98 status_area_view_->AddButton(new MultipleWindowIndicatorButton(this),
99 StatusAreaView::NO_BORDER);
100 }
101
102 // Create widget to hold status area view. 65 // Create widget to hold status area view.
103 status_area_widget_ = new views::Widget; 66 status_area_widget_ = new views::Widget;
104 views::Widget::InitParams params( 67 views::Widget::InitParams params(
105 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 68 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
106 gfx::Size ps = status_area_view_->GetPreferredSize(); 69 gfx::Size ps = status_area_view_->GetPreferredSize();
107 params.bounds = gfx::Rect(0, 0, ps.width(), ps.height()); 70 params.bounds = gfx::Rect(0, 0, ps.width(), ps.height());
108 params.delegate = status_area_view_; 71 params.delegate = status_area_view_;
109 params.parent = status_window; 72 params.parent = status_window;
110 params.transparent = true; 73 params.transparent = true;
111 status_area_widget_->Init(params); 74 status_area_widget_->Init(params);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 174 }
212 } 175 }
213 #endif 176 #endif
214 } 177 }
215 178
216 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const { 179 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
217 #if defined(OS_CHROMEOS) 180 #if defined(OS_CHROMEOS)
218 if (IsLoginOrLockScreenDisplayed()) 181 if (IsLoginOrLockScreenDisplayed())
219 return StatusAreaButton::GRAY_PLAIN_LIGHT; 182 return StatusAreaButton::GRAY_PLAIN_LIGHT;
220 #endif 183 #endif
221 184 return StatusAreaButton::WHITE_HALOED_BOLD;
222 if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
223 Browser* browser = BrowserList::GetLastActive();
224 if (!browser)
225 return StatusAreaButton::WHITE_HALOED_BOLD;
226
227 ThemeService* theme_service =
228 ThemeServiceFactory::GetForProfile(browser->profile());
229 if (!theme_service->UsingDefaultTheme())
230 return StatusAreaButton::WHITE_HALOED_BOLD;
231
232 return browser->profile()->IsOffTheRecord() ?
233 StatusAreaButton::WHITE_PLAIN_BOLD :
234 StatusAreaButton::GRAY_EMBOSSED_BOLD;
235 } else {
236 return StatusAreaButton::WHITE_HALOED_BOLD;
237 }
238 } 185 }
239 186
240 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) { 187 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) {
241 if (status_area_view_) 188 if (status_area_view_)
242 status_area_view_->UpdateButtonVisibility(); 189 status_area_view_->UpdateButtonVisibility();
243 } 190 }
244 191
245 void StatusAreaHostAura::OnBrowserSetLastActive(const Browser* browser) { 192 void StatusAreaHostAura::OnBrowserSetLastActive(const Browser* browser) {
246 UpdateAppearance(); 193 UpdateAppearance();
247 } 194 }
(...skipping 25 matching lines...) Expand all
273 chromeos::ScreenLocker::default_screen_locker(); 220 chromeos::ScreenLocker::default_screen_locker();
274 if (locker && locker->locked()) 221 if (locker && locker->locked())
275 return true; 222 return true;
276 #endif 223 #endif
277 224
278 return false; 225 return false;
279 } 226 }
280 227
281 void StatusAreaHostAura::UpdateAppearance() { 228 void StatusAreaHostAura::UpdateAppearance() {
282 status_area_view_->UpdateButtonTextStyle(); 229 status_area_view_->UpdateButtonTextStyle();
283
284 gfx::Size offset = IsLoginOrLockScreenDisplayed() ?
285 GetCompactModeLoginAndLockOffset() :
286 GetCompactModeBrowserOffset();
287 ash::Shell::GetInstance()->SetCompactStatusAreaOffset(offset);
288 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/ash/status_area_host_aura.h ('k') | chrome/browser/ui/views/ash/status_area_host_aura_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698