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

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

Issue 8509027: Add status area to Aura builds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move status area view ids back to chromeos 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
« no previous file with comments | « chrome/browser/ui/views/aura/status_area_host_aura.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/aura/status_area_host_aura.h"
6
7 #include "base/command_line.h"
8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/view_ids.h"
11 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
12 #include "chrome/browser/chromeos/status/clock_menu_button.h"
13 #include "chrome/browser/chromeos/status/memory_menu_button.h"
14 #include "chrome/browser/chromeos/status/status_area_view.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "ui/aura/window.h"
17 #include "ui/aura_shell/shell.h"
18 #include "ui/aura_shell/shell_window_ids.h"
19 #include "views/widget/widget.h"
20
21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h"
23 #endif
24
25 StatusAreaHostAura::StatusAreaHostAura()
26 : status_area_widget_(NULL),
27 status_area_view_(NULL) {
28 }
29
30 views::Widget* StatusAreaHostAura::CreateStatusArea() {
31 aura_shell::Shell* aura_shell = aura_shell::Shell::GetInstance();
32 aura::Window* status_window = aura_shell->GetContainer(
33 aura_shell::internal::kShellWindowId_StatusContainer);
34
35 // Create status area view.
36 status_area_view_ = new StatusAreaView();
37
38 // Add child buttons.
39 #if defined(OS_CHROMEOS)
40 chromeos::StatusAreaViewChromeos::AddChromeosButtons(
41 status_area_view_, this, chromeos::StatusAreaViewChromeos::BROWSER_MODE);
42 #else
43 const bool border = true;
44 const bool no_border = false;
45 #if defined(OS_LINUX)
46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kMemoryWidget))
47 status_area_view_->AddButton(new MemoryMenuButton(this), no_border);
48 #endif
49 status_area_view_->AddButton(new ClockMenuButton(this), border);
50 #endif
51
52 // Create widget to hold status area view.
53 status_area_widget_ = new views::Widget;
54 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
55 gfx::Size ps = status_area_view_->GetPreferredSize();
56 params.bounds = gfx::Rect(0, 0, ps.width(), ps.height());
57 params.parent = status_window;
58 params.transparent = true;
59 status_area_widget_->Init(params);
60 status_area_widget_->SetContentsView(status_area_view_);
61 status_area_widget_->Show();
62 status_area_widget_->GetNativeView()->set_name("StatusAreaView");
63
64 return status_area_widget_;
65 }
66
67 // StatusAreaButton::Delegate implementation.
68
69 bool StatusAreaHostAura::ShouldExecuteStatusAreaCommand(
70 const views::View* button_view, int command_id) const {
71 #if defined(OS_CHROMEOS)
72 return true;
73 #else
74 // TODO(stevenjb): system options for non-chromeos Aura?
75 return false;
76 #endif
77 }
78
79 void StatusAreaHostAura::ExecuteStatusAreaCommand(
80 const views::View* button_view, int command_id) {
81 #if defined(OS_CHROMEOS)
82 Browser* browser = BrowserList::FindBrowserWithProfile(
83 ProfileManager::GetDefaultProfile());
84 switch (command_id) {
85 case StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS:
86 browser->OpenInternetOptionsDialog();
87 break;
88 case StatusAreaButton::Delegate::SHOW_LANGUAGE_OPTIONS:
89 browser->OpenLanguageOptionsDialog();
90 break;
91 case StatusAreaButton::Delegate::SHOW_SYSTEM_OPTIONS:
92 browser->OpenSystemOptionsDialog();
93 break;
94 default:
95 NOTREACHED();
96 }
97 #endif
98 }
99
100 gfx::Font StatusAreaHostAura::GetStatusAreaFont(const gfx::Font& font) const {
101 return font.DeriveFont(0, gfx::Font::BOLD);
102 }
103
104 StatusAreaButton::TextStyle StatusAreaHostAura::GetStatusAreaTextStyle() const {
105 return StatusAreaButton::WHITE_HALOED;
106 }
107
108 void StatusAreaHostAura::ButtonVisibilityChanged(views::View* button_view) {
109 if (status_area_view_)
110 status_area_view_->UpdateButtonVisibility();
111 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/status_area_host_aura.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698