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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 14 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
15 #include "chrome/browser/ui/view_ids.h" 15 #include "chrome/browser/ui/view_ids.h"
16 #include "chrome/browser/ui/views/browser_actions_container.h" 16 #include "chrome/browser/ui/views/browser_actions_container.h"
17 #include "chrome/browser/ui/views/event_utils.h" 17 #include "chrome/browser/ui/views/event_utils.h"
18 #include "chrome/browser/ui/views/wrench_menu.h" 18 #include "chrome/browser/ui/views/wrench_menu.h"
19 #include "chrome/browser/upgrade_detector.h" 19 #include "chrome/browser/upgrade_detector.h"
20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "content/browser/accessibility/browser_accessibility_state.h" 22 #include "content/browser/accessibility/browser_accessibility_state.h"
22 #include "content/browser/user_metrics.h" 23 #include "content/browser/user_metrics.h"
23 #include "content/common/notification_service.h" 24 #include "content/common/notification_service.h"
24 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "grit/theme_resources_standard.h" 28 #include "grit/theme_resources_standard.h"
28 #include "ui/base/accessibility/accessible_view_state.h" 29 #include "ui/base/accessibility/accessible_view_state.h"
29 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 browser_->command_updater()->AddCommandObserver(IDC_HOME, this); 96 browser_->command_updater()->AddCommandObserver(IDC_HOME, this);
96 97
97 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 98 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
98 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; 99 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
99 100
100 if (!kPopupBackgroundEdge) { 101 if (!kPopupBackgroundEdge) {
101 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( 102 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed(
102 IDR_LOCATIONBG_POPUPMODE_EDGE); 103 IDR_LOCATIONBG_POPUPMODE_EDGE);
103 } 104 }
104 105
105 registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, 106 registrar_.Add(this, chrome::UPGRADE_RECOMMENDED,
106 NotificationService::AllSources()); 107 NotificationService::AllSources());
107 registrar_.Add(this, NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE, 108 registrar_.Add(this, chrome::MODULE_INCOMPATIBILITY_BADGE_CHANGE,
108 NotificationService::AllSources()); 109 NotificationService::AllSources());
109 } 110 }
110 111
111 ToolbarView::~ToolbarView() { 112 ToolbarView::~ToolbarView() {
112 // NOTE: Don't remove the command observers here. This object gets destroyed 113 // NOTE: Don't remove the command observers here. This object gets destroyed
113 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is 114 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is
114 // already gone. 115 // already gone.
115 } 116 }
116 117
117 void ToolbarView::Init(Profile* profile) { 118 void ToolbarView::Init(Profile* profile) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 396 }
396 browser_->ExecuteCommandWithDisposition(command, disposition); 397 browser_->ExecuteCommandWithDisposition(command, disposition);
397 } 398 }
398 399
399 //////////////////////////////////////////////////////////////////////////////// 400 ////////////////////////////////////////////////////////////////////////////////
400 // ToolbarView, NotificationObserver implementation: 401 // ToolbarView, NotificationObserver implementation:
401 402
402 void ToolbarView::Observe(NotificationType type, 403 void ToolbarView::Observe(NotificationType type,
403 const NotificationSource& source, 404 const NotificationSource& source,
404 const NotificationDetails& details) { 405 const NotificationDetails& details) {
405 if (type == NotificationType::PREF_CHANGED) { 406 if (type == chrome::PREF_CHANGED) {
406 std::string* pref_name = Details<std::string>(details).ptr(); 407 std::string* pref_name = Details<std::string>(details).ptr();
407 if (*pref_name == prefs::kShowHomeButton) { 408 if (*pref_name == prefs::kShowHomeButton) {
408 Layout(); 409 Layout();
409 SchedulePaint(); 410 SchedulePaint();
410 } 411 }
411 } else if (type == NotificationType::UPGRADE_RECOMMENDED || 412 } else if (type == chrome::UPGRADE_RECOMMENDED ||
412 type == NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE) { 413 type == chrome::MODULE_INCOMPATIBILITY_BADGE_CHANGE) {
413 UpdateAppMenuBadge(); 414 UpdateAppMenuBadge();
414 } 415 }
415 } 416 }
416 417
417 //////////////////////////////////////////////////////////////////////////////// 418 ////////////////////////////////////////////////////////////////////////////////
418 // ToolbarView, ui::AcceleratorProvider implementation: 419 // ToolbarView, ui::AcceleratorProvider implementation:
419 420
420 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 421 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
421 ui::Accelerator* accelerator) { 422 ui::Accelerator* accelerator) {
422 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators 423 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 689 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
689 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 690 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
690 } 691 }
691 692
692 void ToolbarView::UpdateAppMenuBadge() { 693 void ToolbarView::UpdateAppMenuBadge() {
693 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 694 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
694 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 695 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
695 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 696 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
696 SchedulePaint(); 697 SchedulePaint();
697 } 698 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698