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

Side by Side Diff: chrome/browser/ui/cocoa/history_menu_bridge.h

Issue 651193002: Remove NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@373326.2
Patch Set: Created 6 years, 2 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
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 #ifndef CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_
6 #define CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_ 6 #define CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/task/cancelable_task_tracker.h" 14 #include "base/task/cancelable_task_tracker.h"
15 #import "chrome/browser/favicon/favicon_service.h" 15 #import "chrome/browser/favicon/favicon_service.h"
16 #include "chrome/browser/history/history_service.h" 16 #include "chrome/browser/history/history_service.h"
17 #include "chrome/browser/sessions/tab_restore_service.h" 17 #include "chrome/browser/sessions/tab_restore_service.h"
18 #include "chrome/browser/sessions/tab_restore_service_observer.h" 18 #include "chrome/browser/sessions/tab_restore_service_observer.h"
19 #import "chrome/browser/ui/cocoa/main_menu_item.h" 19 #import "chrome/browser/ui/cocoa/main_menu_item.h"
20 #include "components/history/core/browser/history_service_observer.h"
20 #include "components/sessions/session_id.h" 21 #include "components/sessions/session_id.h"
21 #include "content/public/browser/notification_observer.h" 22 #include "content/public/browser/notification_observer.h"
22 23
23 class NotificationRegistrar; 24 class NotificationRegistrar;
24 class PageUsageData; 25 class PageUsageData;
25 class Profile; 26 class Profile;
26 class TabRestoreService; 27 class TabRestoreService;
27 @class HistoryMenuCocoaController; 28 @class HistoryMenuCocoaController;
28 29
29 namespace { 30 namespace {
(...skipping 21 matching lines...) Expand all
51 // action mechanism. 52 // action mechanism.
52 // 53 //
53 // These menu items do not use firstResponder as their target. Rather, they are 54 // These menu items do not use firstResponder as their target. Rather, they are
54 // hooked directly up to the HistoryMenuCocoaController that then bridges back 55 // hooked directly up to the HistoryMenuCocoaController that then bridges back
55 // to this class. These items are created via the AddItemToMenu() helper. Also, 56 // to this class. These items are created via the AddItemToMenu() helper. Also,
56 // unlike the typical ownership model, this bridge owns its controller. The 57 // unlike the typical ownership model, this bridge owns its controller. The
57 // controller is very thin and only exists to interact with Cocoa, but this 58 // controller is very thin and only exists to interact with Cocoa, but this
58 // class does the bulk of the work. 59 // class does the bulk of the work.
59 class HistoryMenuBridge : public content::NotificationObserver, 60 class HistoryMenuBridge : public content::NotificationObserver,
60 public TabRestoreServiceObserver, 61 public TabRestoreServiceObserver,
61 public MainMenuItem { 62 public MainMenuItem,
63 public history::HistoryServiceObserver {
62 public: 64 public:
63 // This is a generalization of the data we store in the history menu because 65 // This is a generalization of the data we store in the history menu because
64 // we pull things from different sources with different data types. 66 // we pull things from different sources with different data types.
65 struct HistoryItem { 67 struct HistoryItem {
66 public: 68 public:
67 HistoryItem(); 69 HistoryItem();
68 // Copy constructor allowed. 70 // Copy constructor allowed.
69 HistoryItem(const HistoryItem& copy); 71 HistoryItem(const HistoryItem& copy);
70 ~HistoryItem(); 72 ~HistoryItem();
71 73
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 }; 126 };
125 127
126 explicit HistoryMenuBridge(Profile* profile); 128 explicit HistoryMenuBridge(Profile* profile);
127 virtual ~HistoryMenuBridge(); 129 virtual ~HistoryMenuBridge();
128 130
129 // content::NotificationObserver: 131 // content::NotificationObserver:
130 virtual void Observe(int type, 132 virtual void Observe(int type,
131 const content::NotificationSource& source, 133 const content::NotificationSource& source,
132 const content::NotificationDetails& details) override; 134 const content::NotificationDetails& details) override;
133 135
136 // history::HistoryServiceObserver:
137 virtual void OnURLVisited(HistoryService* history_service,
138 ui::PageTransition transition,
139 const history::URLRow& row,
140 const history::RedirectList& redirects,
141 base::Time visit_time) override;
142
134 // TabRestoreServiceObserver: 143 // TabRestoreServiceObserver:
135 virtual void TabRestoreServiceChanged(TabRestoreService* service) override; 144 virtual void TabRestoreServiceChanged(TabRestoreService* service) override;
136 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) override; 145 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) override;
137 146
138 // MainMenuItem: 147 // MainMenuItem:
139 virtual void ResetMenu() override; 148 virtual void ResetMenu() override;
140 virtual void BuildMenu() override; 149 virtual void BuildMenu() override;
141 150
142 // Looks up an NSMenuItem in the |menu_item_map_| and returns the 151 // Looks up an NSMenuItem in the |menu_item_map_| and returns the
143 // corresponding HistoryItem. 152 // corresponding HistoryItem.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 bool create_in_progress_; 232 bool create_in_progress_;
224 bool need_recreate_; 233 bool need_recreate_;
225 234
226 // The default favicon if a HistoryItem does not have one. 235 // The default favicon if a HistoryItem does not have one.
227 base::scoped_nsobject<NSImage> default_favicon_; 236 base::scoped_nsobject<NSImage> default_favicon_;
228 237
229 DISALLOW_COPY_AND_ASSIGN(HistoryMenuBridge); 238 DISALLOW_COPY_AND_ASSIGN(HistoryMenuBridge);
230 }; 239 };
231 240
232 #endif // CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_ 241 #endif // CHROME_BROWSER_UI_COCOA_HISTORY_MENU_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698