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

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

Issue 9570044: Rename chrome/browser/ui/views/{aura => ash}/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 months 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
(Empty)
1 // Copyright (c) 2012 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/multiple_window_indicator_button.h"
6
7 #include "grit/theme_resources.h"
8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/image/image.h"
10 #include "ui/views/border.h"
11
12 MultipleWindowIndicatorButton::MultipleWindowIndicatorButton(
13 StatusAreaButton::Delegate* delegate)
14 : StatusAreaButton(delegate, NULL) {
15 SetIcon(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
16 IDR_STATUSBAR_MULTIPLE_WINDOW));
17 UpdateVisiblity();
18 BrowserList::AddObserver(this);
19 }
20
21 MultipleWindowIndicatorButton::~MultipleWindowIndicatorButton() {
22 BrowserList::RemoveObserver(this);
23 }
24
25 void MultipleWindowIndicatorButton::OnBrowserAdded(const Browser* browser) {
26 UpdateVisiblity();
27 }
28
29 void MultipleWindowIndicatorButton::OnBrowserRemoved(const Browser* browser) {
30 UpdateVisiblity();
31 }
32
33 void MultipleWindowIndicatorButton::UpdateVisiblity() {
34 bool visible = false;
35 int count = 0;
36 for (BrowserList::const_iterator it = BrowserList::begin();
37 it != BrowserList::end(); ++it) {
38 if ((*it)->is_type_tabbed()) {
39 ++count;
40 if (count >= 2) {
41 visible = true;
42 break;
43 }
44 }
45 }
46 SetVisible(visible);
47 }
48
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/multiple_window_indicator_button.h ('k') | chrome/browser/ui/views/aura/panel_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698