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

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

Issue 8585031: [cros, Aura] Make screen_mode static variable in StatusAreaViewChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/status_area_host_aura.h" 5 #include "chrome/browser/ui/views/aura/status_area_host_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/status/clock_menu_button.h" 8 #include "chrome/browser/chromeos/status/clock_menu_button.h"
9 #include "chrome/browser/chromeos/status/memory_menu_button.h" 9 #include "chrome/browser/chromeos/status/memory_menu_button.h"
10 #include "chrome/browser/chromeos/status/status_area_view.h" 10 #include "chrome/browser/chromeos/status/status_area_view.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/view_ids.h" 13 #include "chrome/browser/ui/view_ids.h"
14 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" 14 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/aura_shell/shell.h" 17 #include "ui/aura_shell/shell.h"
18 #include "ui/aura_shell/shell_window_ids.h" 18 #include "ui/aura_shell/shell_window_ids.h"
19 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/login/base_login_display_host.h"
23 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
22 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" 24 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
23 #include "chrome/browser/chromeos/status/timezone_clock_updater.h" 25 #include "chrome/browser/chromeos/status/timezone_clock_updater.h"
26 #include "ui/gfx/native_widget_types.h"
24 #endif 27 #endif
25 28
26 StatusAreaHostAura::StatusAreaHostAura() 29 StatusAreaHostAura::StatusAreaHostAura()
27 : status_area_widget_(NULL), 30 : status_area_widget_(NULL),
28 status_area_view_(NULL) { 31 status_area_view_(NULL) {
29 } 32 }
30 33
31 StatusAreaHostAura::~StatusAreaHostAura() { 34 StatusAreaHostAura::~StatusAreaHostAura() {
32 } 35 }
33 36
34 views::View* StatusAreaHostAura::GetStatusAreaForTest() { 37 views::View* StatusAreaHostAura::GetStatusAreaForTest() {
35 return status_area_view_; 38 return status_area_view_;
36 } 39 }
37 40
38 views::Widget* StatusAreaHostAura::CreateStatusArea() { 41 views::Widget* StatusAreaHostAura::CreateStatusArea() {
39 aura_shell::Shell* aura_shell = aura_shell::Shell::GetInstance(); 42 aura_shell::Shell* aura_shell = aura_shell::Shell::GetInstance();
40 aura::Window* status_window = aura_shell->GetContainer( 43 aura::Window* status_window = aura_shell->GetContainer(
41 aura_shell::internal::kShellWindowId_StatusContainer); 44 aura_shell::internal::kShellWindowId_StatusContainer);
42 45
43 // Create status area view. 46 // Create status area view.
44 status_area_view_ = new StatusAreaView(); 47 status_area_view_ = new StatusAreaView();
45 48
46 // Add child buttons. 49 // Add child buttons.
47 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
48 ClockMenuButton* clock = NULL; 51 ClockMenuButton* clock = NULL;
49 chromeos::StatusAreaViewChromeos::AddChromeosButtons( 52 chromeos::StatusAreaViewChromeos::AddChromeosButtons(status_area_view_,
50 status_area_view_, this, chromeos::StatusAreaViewChromeos::BROWSER_MODE, 53 this,
51 &clock); 54 &clock);
52 DCHECK(clock); 55 DCHECK(clock);
53 timezone_clock_updater_.reset(new TimezoneClockUpdater(clock)); 56 timezone_clock_updater_.reset(new TimezoneClockUpdater(clock));
54 #else 57 #else
55 const bool border = true; 58 const bool border = true;
56 const bool no_border = false; 59 const bool no_border = false;
57 #if defined(OS_LINUX) 60 #if defined(OS_LINUX)
58 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) 61 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
59 status_area_view_->AddButton(new MemoryMenuButton(this), no_border); 62 status_area_view_->AddButton(new MemoryMenuButton(this), no_border);
60 #endif 63 #endif
61 status_area_view_->AddButton(new ClockMenuButton(this), border); 64 status_area_view_->AddButton(new ClockMenuButton(this), border);
(...skipping 12 matching lines...) Expand all
74 status_area_widget_->GetNativeView()->set_name("StatusAreaView"); 77 status_area_widget_->GetNativeView()->set_name("StatusAreaView");
75 78
76 return status_area_widget_; 79 return status_area_widget_;
77 } 80 }
78 81
79 // StatusAreaButton::Delegate implementation. 82 // StatusAreaButton::Delegate implementation.
80 83
81 bool StatusAreaHostAura::ShouldExecuteStatusAreaCommand( 84 bool StatusAreaHostAura::ShouldExecuteStatusAreaCommand(
82 const views::View* button_view, int command_id) const { 85 const views::View* button_view, int command_id) const {
83 #if defined(OS_CHROMEOS) 86 #if defined(OS_CHROMEOS)
84 return true; 87 if (chromeos::StatusAreaViewChromeos::IsLoginMode()) {
88 // In login mode network options command means proxy settings dialog.
89 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS)
90 return true;
91 else
92 return false;
93 } else {
94 return true;
95 }
85 #else 96 #else
86 // TODO(stevenjb): system options for non-chromeos Aura? 97 // TODO(stevenjb): system options for non-chromeos Aura?
87 return false; 98 return false;
88 #endif 99 #endif
89 } 100 }
90 101
91 void StatusAreaHostAura::ExecuteStatusAreaCommand( 102 void StatusAreaHostAura::ExecuteStatusAreaCommand(
92 const views::View* button_view, int command_id) { 103 const views::View* button_view, int command_id) {
93 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
94 Browser* browser = BrowserList::FindBrowserWithProfile( 105 if (chromeos::StatusAreaViewChromeos::IsBrowserMode()) {
95 ProfileManager::GetDefaultProfile()); 106 Browser* browser = BrowserList::FindBrowserWithProfile(
96 switch (command_id) { 107 ProfileManager::GetDefaultProfile());
97 case StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS: 108 switch (command_id) {
98 browser->OpenInternetOptionsDialog(); 109 case StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS:
99 break; 110 browser->OpenInternetOptionsDialog();
100 case StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS: 111 break;
101 browser->OpenLanguageOptionsDialog(); 112 case StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS:
102 break; 113 browser->OpenLanguageOptionsDialog();
103 case StatusAreaButton::Delegate::SHOW_SYSTEM_OPTIONS: 114 break;
104 browser->OpenSystemOptionsDialog(); 115 case StatusAreaButton::Delegate::SHOW_SYSTEM_OPTIONS:
105 break; 116 browser->OpenSystemOptionsDialog();
106 default: 117 break;
118 default:
119 NOTREACHED();
120 }
121 } else if (chromeos::StatusAreaViewChromeos::IsLoginMode()) {
122 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS &&
123 chromeos::BaseLoginDisplayHost::default_host()) {
124 gfx::NativeWindow native_window =
125 chromeos::BaseLoginDisplayHost::default_host()->GetNativeWindow();
126 proxy_settings_dialog_.reset(new chromeos::ProxySettingsDialog(
127 NULL, native_window));
128 proxy_settings_dialog_->Show();
129 } else {
107 NOTREACHED(); 130 NOTREACHED();
131 }
108 } 132 }
109 #endif 133 #endif
110 } 134 }
111 135
112 gfx::Font StatusAreaHostAura::GetStatusAreaFont(const gfx::Font& font) const { 136 gfx::Font StatusAreaHostAura::GetStatusAreaFont(const gfx::Font& font) const {
113 return font.DeriveFont(0, gfx::Font::BOLD); 137 return font.DeriveFont(0, gfx::Font::BOLD);
114 } 138 }
115 139
116 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const { 140 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
117 return StatusAreaButton::WHITE_HALOED; 141 return StatusAreaButton::WHITE_HALOED;
118 } 142 }
119 143
120 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) { 144 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) {
121 if (status_area_view_) 145 if (status_area_view_)
122 status_area_view_->UpdateButtonVisibility(); 146 status_area_view_->UpdateButtonVisibility();
123 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/status_area_host_aura.h ('k') | chrome/browser/ui/webui/chromeos/login/network_dropdown.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698