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

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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/ui/views/wrench_menu.cc » ('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"
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 browser_->command_updater()->AddCommandObserver(IDC_HOME, this); 97 browser_->command_updater()->AddCommandObserver(IDC_HOME, this);
97 98
98 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ? 99 display_mode_ = browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP) ?
99 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION; 100 DISPLAYMODE_NORMAL : DISPLAYMODE_LOCATION;
100 101
101 if (!kPopupBackgroundEdge) { 102 if (!kPopupBackgroundEdge) {
102 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( 103 kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed(
103 IDR_LOCATIONBG_POPUPMODE_EDGE); 104 IDR_LOCATIONBG_POPUPMODE_EDGE);
104 } 105 }
105 106
106 registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, 107 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
107 NotificationService::AllSources()); 108 NotificationService::AllSources());
108 registrar_.Add(this, NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE, 109 registrar_.Add(this,
110 chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE,
109 NotificationService::AllSources()); 111 NotificationService::AllSources());
110 } 112 }
111 113
112 ToolbarView::~ToolbarView() { 114 ToolbarView::~ToolbarView() {
113 // NOTE: Don't remove the command observers here. This object gets destroyed 115 // NOTE: Don't remove the command observers here. This object gets destroyed
114 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is 116 // after the Browser (which owns the CommandUpdater), so the CommandUpdater is
115 // already gone. 117 // already gone.
116 } 118 }
117 119
118 void ToolbarView::Init(Profile* profile) { 120 void ToolbarView::Init(Profile* profile) {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // ongoing user edits, since it doesn't realize this is a user-initiated 399 // ongoing user edits, since it doesn't realize this is a user-initiated
398 // action. 400 // action.
399 location_bar_->Revert(); 401 location_bar_->Revert();
400 } 402 }
401 browser_->ExecuteCommandWithDisposition(command, disposition); 403 browser_->ExecuteCommandWithDisposition(command, disposition);
402 } 404 }
403 405
404 //////////////////////////////////////////////////////////////////////////////// 406 ////////////////////////////////////////////////////////////////////////////////
405 // ToolbarView, NotificationObserver implementation: 407 // ToolbarView, NotificationObserver implementation:
406 408
407 void ToolbarView::Observe(NotificationType type, 409 void ToolbarView::Observe(int type,
408 const NotificationSource& source, 410 const NotificationSource& source,
409 const NotificationDetails& details) { 411 const NotificationDetails& details) {
410 if (type == NotificationType::PREF_CHANGED) { 412 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
411 std::string* pref_name = Details<std::string>(details).ptr(); 413 std::string* pref_name = Details<std::string>(details).ptr();
412 if (*pref_name == prefs::kShowHomeButton) { 414 if (*pref_name == prefs::kShowHomeButton) {
413 Layout(); 415 Layout();
414 SchedulePaint(); 416 SchedulePaint();
415 } 417 }
416 } else if (type == NotificationType::UPGRADE_RECOMMENDED || 418 } else if (
417 type == NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE) { 419 type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED ||
420 type == chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE) {
418 UpdateAppMenuBadge(); 421 UpdateAppMenuBadge();
419 } 422 }
420 } 423 }
421 424
422 //////////////////////////////////////////////////////////////////////////////// 425 ////////////////////////////////////////////////////////////////////////////////
423 // ToolbarView, ui::AcceleratorProvider implementation: 426 // ToolbarView, ui::AcceleratorProvider implementation:
424 427
425 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 428 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
426 ui::Accelerator* accelerator) { 429 ui::Accelerator* accelerator) {
427 // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators 430 // 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
693 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 696 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
694 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 697 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
695 } 698 }
696 699
697 void ToolbarView::UpdateAppMenuBadge() { 700 void ToolbarView::UpdateAppMenuBadge() {
698 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL)); 701 app_menu_->SetIcon(GetAppMenuIcon(views::CustomButton::BS_NORMAL));
699 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT)); 702 app_menu_->SetHoverIcon(GetAppMenuIcon(views::CustomButton::BS_HOT));
700 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED)); 703 app_menu_->SetPushedIcon(GetAppMenuIcon(views::CustomButton::BS_PUSHED));
701 SchedulePaint(); 704 SchedulePaint();
702 } 705 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.h ('k') | chrome/browser/ui/views/wrench_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698