OLD | NEW |
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 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" | 37 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" |
38 #import "chrome/browser/ui/cocoa/toolbar/reload_button.h" | 38 #import "chrome/browser/ui/cocoa/toolbar/reload_button.h" |
39 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button.h" | 39 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button.h" |
40 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h" | 40 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view.h" |
41 #import "chrome/browser/ui/cocoa/view_id_util.h" | 41 #import "chrome/browser/ui/cocoa/view_id_util.h" |
42 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" | 42 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
43 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 43 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
44 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 44 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
45 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 45 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
46 #include "chrome/browser/upgrade_detector.h" | 46 #include "chrome/browser/upgrade_detector.h" |
| 47 #include "chrome/common/chrome_notification_types.h" |
47 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
48 #include "content/browser/tab_contents/tab_contents.h" | 49 #include "content/browser/tab_contents/tab_contents.h" |
49 #include "content/common/notification_details.h" | 50 #include "content/common/notification_details.h" |
50 #include "content/common/notification_observer.h" | 51 #include "content/common/notification_observer.h" |
51 #include "content/common/notification_service.h" | 52 #include "content/common/notification_service.h" |
52 #include "content/common/notification_type.h" | |
53 #include "grit/chromium_strings.h" | 53 #include "grit/chromium_strings.h" |
54 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
55 #include "grit/theme_resources.h" | 55 #include "grit/theme_resources.h" |
56 #include "grit/theme_resources_standard.h" | 56 #include "grit/theme_resources_standard.h" |
57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
58 #include "ui/base/l10n/l10n_util_mac.h" | 58 #include "ui/base/l10n/l10n_util_mac.h" |
59 #include "ui/base/models/accelerator_cocoa.h" | 59 #include "ui/base/models/accelerator_cocoa.h" |
60 #include "ui/base/models/menu_model.h" | 60 #include "ui/base/models/menu_model.h" |
61 #include "ui/base/resource/resource_bundle.h" | 61 #include "ui/base/resource/resource_bundle.h" |
62 #include "ui/gfx/image/image.h" | 62 #include "ui/gfx/image/image.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 }; | 117 }; |
118 | 118 |
119 // A class registered for C++ notifications. This is used to detect changes in | 119 // A class registered for C++ notifications. This is used to detect changes in |
120 // preferences and upgrade available notifications. Bridges the notification | 120 // preferences and upgrade available notifications. Bridges the notification |
121 // back to the ToolbarController. | 121 // back to the ToolbarController. |
122 class NotificationBridge : public NotificationObserver { | 122 class NotificationBridge : public NotificationObserver { |
123 public: | 123 public: |
124 explicit NotificationBridge(ToolbarController* controller) | 124 explicit NotificationBridge(ToolbarController* controller) |
125 : controller_(controller) { | 125 : controller_(controller) { |
126 registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, | 126 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
127 NotificationService::AllSources()); | 127 NotificationService::AllSources()); |
128 } | 128 } |
129 | 129 |
130 // Overridden from NotificationObserver: | 130 // Overridden from NotificationObserver: |
131 virtual void Observe(NotificationType type, | 131 virtual void Observe(int type, |
132 const NotificationSource& source, | 132 const NotificationSource& source, |
133 const NotificationDetails& details) { | 133 const NotificationDetails& details) { |
134 switch (type.value) { | 134 switch (type) { |
135 case NotificationType::PREF_CHANGED: | 135 case chrome::NOTIFICATION_PREF_CHANGED: |
136 [controller_ prefChanged:Details<std::string>(details).ptr()]; | 136 [controller_ prefChanged:Details<std::string>(details).ptr()]; |
137 break; | 137 break; |
138 case NotificationType::UPGRADE_RECOMMENDED: | 138 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: |
139 [controller_ badgeWrenchMenuIfNeeded]; | 139 [controller_ badgeWrenchMenuIfNeeded]; |
140 break; | 140 break; |
141 default: | 141 default: |
142 NOTREACHED(); | 142 NOTREACHED(); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 private: | 146 private: |
147 ToolbarController* controller_; // weak, owns us | 147 ToolbarController* controller_; // weak, owns us |
148 | 148 |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 787 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
788 // Do nothing. | 788 // Do nothing. |
789 } | 789 } |
790 | 790 |
791 // (URLDropTargetController protocol) | 791 // (URLDropTargetController protocol) |
792 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 792 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
793 // Do nothing. | 793 // Do nothing. |
794 } | 794 } |
795 | 795 |
796 @end | 796 @end |
OLD | NEW |