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

Side by Side Diff: chrome/browser/chromeos/status/status_area_view_chromeos.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/chromeos/status/status_area_view_chromeos.h" 5 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/status/accessibility_menu_button.h" 9 #include "chrome/browser/chromeos/status/accessibility_menu_button.h"
10 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h" 10 #include "chrome/browser/chromeos/status/caps_lock_menu_button.h"
11 #include "chrome/browser/chromeos/status/clock_menu_button.h" 11 #include "chrome/browser/chromeos/status/clock_menu_button.h"
12 #include "chrome/browser/chromeos/status/input_method_menu_button.h" 12 #include "chrome/browser/chromeos/status/input_method_menu_button.h"
13 #include "chrome/browser/chromeos/status/memory_menu_button.h" 13 #include "chrome/browser/chromeos/status/memory_menu_button.h"
14 #include "chrome/browser/chromeos/status/network_menu_button.h" 14 #include "chrome/browser/chromeos/status/network_menu_button.h"
15 #include "chrome/browser/chromeos/status/power_menu_button.h" 15 #include "chrome/browser/chromeos/status/power_menu_button.h"
16 #include "chrome/browser/chromeos/view_ids.h" 16 #include "chrome/browser/chromeos/view_ids.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 // static
22 StatusAreaViewChromeos::ScreenMode
23 StatusAreaViewChromeos::screen_mode = BROWSER_MODE;
24
25 // static
26 bool StatusAreaViewChromeos::IsBrowserMode() {
27 return StatusAreaViewChromeos::screen_mode == BROWSER_MODE;
28 }
29
30 // static
31 bool StatusAreaViewChromeos::IsLoginMode() {
32 return StatusAreaViewChromeos::screen_mode == LOGIN_MODE_WEBUI;
33 }
34
21 StatusAreaViewChromeos::StatusAreaViewChromeos() { 35 StatusAreaViewChromeos::StatusAreaViewChromeos() {
22 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this); 36 CrosLibrary::Get()->GetPowerLibrary()->AddObserver(this);
23 system::TimezoneSettings::GetInstance()->AddObserver(this); 37 system::TimezoneSettings::GetInstance()->AddObserver(this);
24 } 38 }
25 39
26 StatusAreaViewChromeos::~StatusAreaViewChromeos() { 40 StatusAreaViewChromeos::~StatusAreaViewChromeos() {
27 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this); 41 CrosLibrary::Get()->GetPowerLibrary()->RemoveObserver(this);
28 system::TimezoneSettings::GetInstance()->RemoveObserver(this); 42 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
29 } 43 }
30 44
31 void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate, 45 void StatusAreaViewChromeos::Init(StatusAreaButton::Delegate* delegate) {
32 ScreenMode screen_mode) { 46 AddChromeosButtons(this, delegate, NULL);
33 AddChromeosButtons(this, delegate, screen_mode, NULL);
34 } 47 }
35 48
36 void StatusAreaViewChromeos::SystemResumed() { 49 void StatusAreaViewChromeos::SystemResumed() {
37 UpdateClockText(); 50 UpdateClockText();
38 } 51 }
39 52
40 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) { 53 void StatusAreaViewChromeos::TimezoneChanged(const icu::TimeZone& timezone) {
41 UpdateClockText(); 54 UpdateClockText();
42 } 55 }
43 56
44 void StatusAreaViewChromeos::UpdateClockText() { 57 void StatusAreaViewChromeos::UpdateClockText() {
45 ClockMenuButton* clock_button = 58 ClockMenuButton* clock_button =
46 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 59 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
47 if (clock_button) 60 if (clock_button)
48 clock_button->UpdateText(); 61 clock_button->UpdateText();
49 } 62 }
50 63
51 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) { 64 void StatusAreaViewChromeos::SetDefaultUse24HourClock(bool use_24hour_clock) {
52 ClockMenuButton* clock_button = 65 ClockMenuButton* clock_button =
53 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK)); 66 static_cast<ClockMenuButton*>(GetViewByID(VIEW_ID_STATUS_BUTTON_CLOCK));
54 if (clock_button) 67 if (clock_button)
55 clock_button->SetDefaultUse24HourClock(use_24hour_clock); 68 clock_button->SetDefaultUse24HourClock(use_24hour_clock);
56 } 69 }
57 70
58 // static 71 // static
59 void StatusAreaViewChromeos::AddChromeosButtons( 72 void StatusAreaViewChromeos::AddChromeosButtons(
60 StatusAreaView* status_area, 73 StatusAreaView* status_area,
61 StatusAreaButton::Delegate* delegate, 74 StatusAreaButton::Delegate* delegate,
62 ScreenMode screen_mode,
63 ClockMenuButton** clock_button) { 75 ClockMenuButton** clock_button) {
64 const bool border = true; 76 const bool border = true;
65 const bool no_border = false; 77 const bool no_border = false;
66 78
67 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) 79 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
68 status_area->AddButton(new MemoryMenuButton(delegate), no_border); 80 status_area->AddButton(new MemoryMenuButton(delegate), no_border);
69 81
70 status_area->AddButton( 82 status_area->AddButton(new AccessibilityMenuButton(delegate), border);
71 new AccessibilityMenuButton(delegate, screen_mode), border);
72 status_area->AddButton(new CapsLockMenuButton(delegate), border); 83 status_area->AddButton(new CapsLockMenuButton(delegate), border);
73 ClockMenuButton* clock = new ClockMenuButton(delegate); 84 ClockMenuButton* clock = new ClockMenuButton(delegate);
74 status_area->AddButton(clock, border); 85 status_area->AddButton(clock, border);
75 if (clock_button) 86 if (clock_button)
76 *clock_button = clock; 87 *clock_button = clock;
77 88
78 status_area->AddButton( 89 status_area->AddButton(new InputMethodMenuButton(delegate), no_border);
79 new InputMethodMenuButton(delegate, screen_mode), no_border); 90 status_area->AddButton(new NetworkMenuButton(delegate), no_border);
80 status_area->AddButton(
81 new NetworkMenuButton(delegate, screen_mode), no_border);
82 status_area->AddButton(new PowerMenuButton(delegate), no_border); 91 status_area->AddButton(new PowerMenuButton(delegate), no_border);
83 } 92 }
84 93
85 } // namespace chromeos 94 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698