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

Side by Side Diff: chrome/browser/chromeos/login/background_view.cc

Issue 8438064: Separate StatusAreaView from StatusAreaViewChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/chromeos/login/background_view.h" 5 #include "chrome/browser/chromeos/login/background_view.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/login/login_utils.h" 15 #include "chrome/browser/chromeos/login/login_utils.h"
16 #include "chrome/browser/chromeos/login/oobe_progress_bar.h" 16 #include "chrome/browser/chromeos/login/oobe_progress_bar.h"
17 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" 17 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
19 #include "chrome/browser/chromeos/login/shutdown_button.h" 19 #include "chrome/browser/chromeos/login/shutdown_button.h"
20 #include "chrome/browser/chromeos/login/wizard_controller.h" 20 #include "chrome/browser/chromeos/login/wizard_controller.h"
21 #include "chrome/browser/chromeos/status/clock_menu_button.h"
22 #include "chrome/browser/chromeos/status/input_method_menu_button.h"
23 #include "chrome/browser/chromeos/status/network_menu_button.h"
24 #include "chrome/browser/chromeos/status/status_area_view.h"
25 #include "chrome/browser/policy/browser_policy_connector.h" 21 #include "chrome/browser/policy/browser_policy_connector.h"
26 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
27 #include "chrome/browser/ui/views/dom_view.h" 23 #include "chrome/browser/ui/views/dom_view.h"
28 #include "chrome/browser/ui/views/window.h" 24 #include "chrome/browser/ui/views/window.h"
29 #include "chrome/common/chrome_version_info.h" 25 #include "chrome/common/chrome_version_info.h"
30 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
31 #include "grit/chromium_strings.h" 27 #include "grit/chromium_strings.h"
32 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
33 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
34 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" 30 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 70
75 } // namespace 71 } // namespace
76 72
77 namespace chromeos { 73 namespace chromeos {
78 74
79 /////////////////////////////////////////////////////////////////////////////// 75 ///////////////////////////////////////////////////////////////////////////////
80 // BackgroundView public: 76 // BackgroundView public:
81 77
82 BackgroundView::BackgroundView() 78 BackgroundView::BackgroundView()
83 : status_area_(NULL), 79 : status_area_(NULL),
80 screen_mode_(StatusAreaViewChromeos::LOGIN_MODE_VIEWS),
84 os_version_label_(NULL), 81 os_version_label_(NULL),
85 boot_times_label_(NULL), 82 boot_times_label_(NULL),
86 progress_bar_(NULL), 83 progress_bar_(NULL),
87 shutdown_button_(NULL), 84 shutdown_button_(NULL),
88 #if defined(OFFICIAL_BUILD) 85 #if defined(OFFICIAL_BUILD)
89 is_official_build_(true), 86 is_official_build_(true),
90 #else 87 #else
91 is_official_build_(false), 88 is_official_build_(false),
92 #endif 89 #endif
93 background_area_(NULL), 90 background_area_(NULL),
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool BackgroundView::IsScreenSaverVisible() { 206 bool BackgroundView::IsScreenSaverVisible() {
210 return ScreenSaverEnabled() && background_area_->IsVisible(); 207 return ScreenSaverEnabled() && background_area_->IsVisible();
211 } 208 }
212 209
213 bool BackgroundView::ScreenSaverEnabled() { 210 bool BackgroundView::ScreenSaverEnabled() {
214 return background_area_ != NULL; 211 return background_area_ != NULL;
215 } 212 }
216 213
217 void BackgroundView::SetDefaultUse24HourClock(bool use_24hour_clock) { 214 void BackgroundView::SetDefaultUse24HourClock(bool use_24hour_clock) {
218 DCHECK(status_area_); 215 DCHECK(status_area_);
219 status_area_->clock_view()->SetDefaultUse24HourClock(use_24hour_clock); 216 status_area_->SetDefaultUse24HourClock(use_24hour_clock);
220 } 217 }
221 218
222 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
223 // BackgroundView protected: 220 // BackgroundView protected:
224 221
225 void BackgroundView::Layout() { 222 void BackgroundView::Layout() {
226 const int kCornerPadding = 5; 223 const int kCornerPadding = 5;
227 const int kInfoLeftPadding = 10; 224 const int kInfoLeftPadding = 10;
228 const int kInfoBottomPadding = 10; 225 const int kInfoBottomPadding = 10;
229 const int kInfoBetweenLinesPadding = 1; 226 const int kInfoBetweenLinesPadding = 1;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 261 }
265 if (background_area_) 262 if (background_area_)
266 background_area_->SetBoundsRect(this->bounds()); 263 background_area_->SetBoundsRect(this->bounds());
267 } 264 }
268 265
269 void BackgroundView::ChildPreferredSizeChanged(View* child) { 266 void BackgroundView::ChildPreferredSizeChanged(View* child) {
270 Layout(); 267 Layout();
271 SchedulePaint(); 268 SchedulePaint();
272 } 269 }
273 270
274 Profile* BackgroundView::GetProfile() const { 271 // Overridden from StatusAreaButton::Delegate:
275 return NULL; 272
273 bool BackgroundView::ShouldExecuteStatusAreaCommand(
274 const views::View* button_view, int command_id) const {
275 if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS)
276 return true;
277 return false;
276 } 278 }
277 279
278 bool BackgroundView::ShouldOpenButtonOptions( 280 void BackgroundView::ExecuteStatusAreaCommand(
279 const views::View* button_view) const { 281 const views::View* button_view, int command_id) {
280 if (button_view == status_area_->network_view()) { 282 if (command_id == StatusAreaViewChromeos::SHOW_NETWORK_OPTIONS) {
281 return true;
282 }
283 if (button_view == status_area_->clock_view() ||
284 button_view == status_area_->input_method_view()) {
285 return false;
286 }
287 return true;
288 }
289
290 void BackgroundView::OpenButtonOptions(const views::View* button_view) {
291 if (button_view == status_area_->network_view()) {
292 if (proxy_settings_dialog_.get() == NULL) { 283 if (proxy_settings_dialog_.get() == NULL) {
293 proxy_settings_dialog_.reset(new ProxySettingsDialog( 284 proxy_settings_dialog_.reset(new ProxySettingsDialog(
294 this, GetNativeWindow())); 285 this, GetNativeWindow()));
295 } 286 }
296 proxy_settings_dialog_->Show(); 287 proxy_settings_dialog_->Show();
297 } 288 }
298 } 289 }
299 290
300 StatusAreaHost::ScreenMode BackgroundView::GetScreenMode() const { 291 gfx::Font BackgroundView::GetStatusAreaFont(const gfx::Font& font) const {
301 return kViewsLoginMode; 292 return font.DeriveFont(0, gfx::Font::BOLD);
302 } 293 }
303 294
304 StatusAreaHost::TextStyle BackgroundView::GetTextStyle() const { 295 StatusAreaButton::TextStyle BackgroundView::GetStatusAreaTextStyle() const {
305 return kGrayPlain; 296 return StatusAreaButton::GRAY_PLAIN;
306 } 297 }
307 298
308 void BackgroundView::ButtonVisibilityChanged(views::View* button_view) { 299 void BackgroundView::ButtonVisibilityChanged(views::View* button_view) {
309 status_area_->ButtonVisibilityChanged(button_view); 300 status_area_->UpdateButtonVisibility();
310 } 301 }
311 302
312 // Overridden from LoginHtmlDialog::Delegate: 303 // Overridden from LoginHtmlDialog::Delegate:
304
313 void BackgroundView::OnLocaleChanged() { 305 void BackgroundView::OnLocaleChanged() {
314 // Proxy settings dialog contains localized strings. 306 // Proxy settings dialog contains localized strings.
315 proxy_settings_dialog_.reset(); 307 proxy_settings_dialog_.reset();
316 InitInfoLabels(); 308 InitInfoLabels();
317 SchedulePaint(); 309 SchedulePaint();
318 } 310 }
319 311
320 void BackgroundView::OnOSVersionLabelTextUpdated( 312 void BackgroundView::OnOSVersionLabelTextUpdated(
321 const std::string& os_version_label_text) { 313 const std::string& os_version_label_text) {
322 os_version_label_->SetText(UTF8ToUTF16(os_version_label_text)); 314 os_version_label_->SetText(UTF8ToUTF16(os_version_label_text));
323 } 315 }
324 316
325 void BackgroundView::OnBootTimesLabelTextUpdated( 317 void BackgroundView::OnBootTimesLabelTextUpdated(
326 const std::string& boot_times_label_text) { 318 const std::string& boot_times_label_text) {
327 boot_times_label_->SetText(UTF8ToUTF16(boot_times_label_text)); 319 boot_times_label_->SetText(UTF8ToUTF16(boot_times_label_text));
328 } 320 }
329 321
330 /////////////////////////////////////////////////////////////////////////////// 322 ///////////////////////////////////////////////////////////////////////////////
331 // BackgroundView private: 323 // BackgroundView private:
332 324
333 void BackgroundView::InitStatusArea() { 325 void BackgroundView::InitStatusArea() {
334 DCHECK(status_area_ == NULL); 326 DCHECK(status_area_ == NULL);
335 status_area_ = new StatusAreaView(this); 327 status_area_ = new StatusAreaViewChromeos();
336 status_area_->Init(); 328 status_area_->Init(this, screen_mode_);
337 AddChildView(status_area_); 329 AddChildView(status_area_);
338 } 330 }
339 331
340 void BackgroundView::InitInfoLabels() { 332 void BackgroundView::InitInfoLabels() {
341 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 333 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
342 334
343 { 335 {
344 int idx = GetIndexOf(os_version_label_); 336 int idx = GetIndexOf(os_version_label_);
345 delete os_version_label_; 337 delete os_version_label_;
346 os_version_label_ = new views::Label(); 338 os_version_label_ = new views::Label();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 #if defined(TOOLKIT_USES_GTK) 382 #if defined(TOOLKIT_USES_GTK)
391 std::vector<int> params; 383 std::vector<int> params;
392 WmIpc::instance()->SetWindowType( 384 WmIpc::instance()->SetWindowType(
393 GTK_WIDGET(GetNativeWindow()), 385 GTK_WIDGET(GetNativeWindow()),
394 WM_IPC_WINDOW_LOGIN_BACKGROUND, 386 WM_IPC_WINDOW_LOGIN_BACKGROUND,
395 &params); 387 &params);
396 #endif 388 #endif
397 } 389 }
398 390
399 } // namespace chromeos 391 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/background_view.h ('k') | chrome/browser/chromeos/login/existing_user_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698