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

Side by Side Diff: chrome/browser/ui/views/toolbar_view.cc

Issue 7948003: Update error badge on wrench menu button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 9 years, 3 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
« no previous file with comments | « chrome/browser/ui/gtk/browser_toolbar_gtk.cc ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/views/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar_view.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (!kPopupBackgroundEdge) { 105 if (!kPopupBackgroundEdge) {
106 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( 106 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed(
107 IDR_LOCATIONBG_POPUPMODE_EDGE); 107 IDR_LOCATIONBG_POPUPMODE_EDGE);
108 } 108 }
109 109
110 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, 110 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
111 NotificationService::AllSources()); 111 NotificationService::AllSources());
112 registrar_.Add(this, 112 registrar_.Add(this,
113 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, 113 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
114 NotificationService::AllSources()); 114 NotificationService::AllSources());
115 registrar_.Add(this, chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
116 Source<Profile>(browser_->profile()));
115 } 117 }
116 118
117 ToolbarView::~ToolbarView() { 119 ToolbarView::~ToolbarView() {
118 // NOTE: Don't remove the command observers here. This object gets destroyed 120 // NOTE: Don't remove the command observers here. This object gets destroyed
119 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is 121 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is
120 // already gone. 122 // already gone.
121 } 123 }
122 124
123 void ToolbarView::Init() { 125 void ToolbarView::Init() {
124 back_menu_model_.reset(new BackForwardMenuModel( 126 back_menu_model_.reset(new BackForwardMenuModel(
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 405 }
404 browser_->ExecuteCommandWithDisposition(command, disposition); 406 browser_->ExecuteCommandWithDisposition(command, disposition);
405 } 407 }
406 408
407 //////////////////////////////////////////////////////////////////////////////// 409 ////////////////////////////////////////////////////////////////////////////////
408 // ToolbarView, NotificationObserver implementation: 410 // ToolbarView, NotificationObserver implementation:
409 411
410 void ToolbarView::Observe(int type, 412 void ToolbarView::Observe(int type,
411 const NotificationSource& source, 413 const NotificationSource& source,
412 const NotificationDetails& details) { 414 const NotificationDetails& details) {
413 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 415 switch (type) {
414 std::string* pref_name = Details<std::string>(details).ptr(); 416 case chrome::NOTIFICATION_PREF_CHANGED: {
415 if (*pref_name == prefs::kShowHomeButton) { 417 std::string* pref_name = Details<std::string>(details).ptr();
416 Layout(); 418 if (*pref_name == prefs::kShowHomeButton) {
417 SchedulePaint(); 419 Layout();
420 SchedulePaint();
421 }
422 break;
418 } 423 }
419 } else if ( 424 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED:
420 type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED || 425 case chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE:
421 type == chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE) { 426 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
422 UpdateAppMenuBadge(); 427 UpdateAppMenuBadge();
428 break;
429 default:
430 NOTREACHED();
423 } 431 }
424 } 432 }
425 433
426 //////////////////////////////////////////////////////////////////////////////// 434 ////////////////////////////////////////////////////////////////////////////////
427 // ToolbarView, ui::AcceleratorProvider implementation: 435 // ToolbarView, ui::AcceleratorProvider implementation:
428 436
429 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 437 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
430 ui::Accelerator* accelerator) { 438 ui::Accelerator* accelerator) {
431 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators 439 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators
432 // anywhere so we need to check for them explicitly here. 440 // anywhere so we need to check for them explicitly here.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 706 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
699 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 707 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
700 } 708 }
701 709
702 void ToolbarView::UpdateAppMenuBadge() { 710 void ToolbarView::UpdateAppMenuBadge() {
703 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 711 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
704 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 712 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
705 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 713 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
706 SchedulePaint(); 714 SchedulePaint();
707 } 715 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_toolbar_gtk.cc ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698