OLD | NEW |
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/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
10 #include "chrome/browser/ui/view_ids.h" | 10 #include "chrome/browser/ui/view_ids.h" |
11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
12 #include "chrome/browser/chromeos/status/clock_menu_button.h" | 12 #include "chrome/browser/chromeos/status/clock_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/status_area_view.h" | 14 #include "chrome/browser/chromeos/status/status_area_view.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 "views/widget/widget.h" | 19 #include "views/widget/widget.h" |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | 22 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
| 23 #include "chrome/browser/chromeos/status/timezone_clock_updater.h" |
23 #endif | 24 #endif |
24 | 25 |
25 StatusAreaHostAura::StatusAreaHostAura() | 26 StatusAreaHostAura::StatusAreaHostAura() |
26 : status_area_widget_(NULL), | 27 : status_area_widget_(NULL), |
27 status_area_view_(NULL) { | 28 status_area_view_(NULL) { |
28 } | 29 } |
29 | 30 |
| 31 StatusAreaHostAura::~StatusAreaHostAura() { |
| 32 } |
| 33 |
| 34 const views::View* StatusAreaHostAura::GetStatusArea() const { |
| 35 return status_area_view_; |
| 36 } |
| 37 |
30 views::Widget* StatusAreaHostAura::CreateStatusArea() { | 38 views::Widget* StatusAreaHostAura::CreateStatusArea() { |
31 aura_shell::Shell* aura_shell = aura_shell::Shell::GetInstance(); | 39 aura_shell::Shell* aura_shell = aura_shell::Shell::GetInstance(); |
32 aura::Window* status_window = aura_shell->GetContainer( | 40 aura::Window* status_window = aura_shell->GetContainer( |
33 aura_shell::internal::kShellWindowId_StatusContainer); | 41 aura_shell::internal::kShellWindowId_StatusContainer); |
34 | 42 |
35 // Create status area view. | 43 // Create status area view. |
36 status_area_view_ = new StatusAreaView(); | 44 status_area_view_ = new StatusAreaView(); |
37 | 45 |
38 // Add child buttons. | 46 // Add child buttons. |
39 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 48 ClockMenuButton* clock = NULL; |
40 chromeos::StatusAreaViewChromeos::AddChromeosButtons( | 49 chromeos::StatusAreaViewChromeos::AddChromeosButtons( |
41 status_area_view_, this, chromeos::StatusAreaViewChromeos::BROWSER_MODE); | 50 status_area_view_, this, chromeos::StatusAreaViewChromeos::BROWSER_MODE, |
| 51 &clock); |
| 52 DCHECK(clock); |
| 53 timezone_clock_updater_.reset(new TimezoneClockUpdater(clock)); |
42 #else | 54 #else |
43 const bool border = true; | 55 const bool border = true; |
44 const bool no_border = false; | 56 const bool no_border = false; |
45 #if defined(OS_LINUX) | 57 #if defined(OS_LINUX) |
46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) | 58 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget)) |
47 status_area_view_->AddButton(new MemoryMenuButton(this), no_border); | 59 status_area_view_->AddButton(new MemoryMenuButton(this), no_border); |
48 #endif | 60 #endif |
49 status_area_view_->AddButton(new ClockMenuButton(this), border); | 61 status_area_view_->AddButton(new ClockMenuButton(this), border); |
50 #endif | 62 #endif |
51 | 63 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 114 } |
103 | 115 |
104 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const { | 116 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const { |
105 return StatusAreaButton::WHITE_HALOED; | 117 return StatusAreaButton::WHITE_HALOED; |
106 } | 118 } |
107 | 119 |
108 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) { | 120 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) { |
109 if (status_area_view_) | 121 if (status_area_view_) |
110 status_area_view_->UpdateButtonVisibility(); | 122 status_area_view_->UpdateButtonVisibility(); |
111 } | 123 } |
OLD | NEW |