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