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

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

Issue 694843002: Remove NOTIFICATION_HISTORY_URLS_MODIFIED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cocoa/history_menu_bridge.h" 5 #include "chrome/browser/ui/cocoa/history_menu_bridge.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 } 109 }
110 110
111 // Note that all requests sent to either the history service or the favicon 111 // Note that all requests sent to either the history service or the favicon
112 // service will be automatically cancelled by their respective Consumers, so 112 // service will be automatically cancelled by their respective Consumers, so
113 // task cancellation is not done manually here in the dtor. 113 // task cancellation is not done manually here in the dtor.
114 HistoryMenuBridge::~HistoryMenuBridge() { 114 HistoryMenuBridge::~HistoryMenuBridge() {
115 // Unregister ourselves as observers and notifications. 115 // Unregister ourselves as observers and notifications.
116 DCHECK(profile_); 116 DCHECK(profile_);
117 if (history_service_) { 117 if (history_service_) {
118 registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED,
119 content::Source<Profile>(profile_));
120 registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 118 registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
121 content::Source<Profile>(profile_)); 119 content::Source<Profile>(profile_));
122 history_service_->RemoveObserver(this); 120 history_service_->RemoveObserver(this);
123 } else { 121 } else {
124 registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_LOADED, 122 registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_LOADED,
125 content::Source<Profile>(profile_)); 123 content::Source<Profile>(profile_));
126 } 124 }
127 125
128 if (tab_restore_service_) 126 if (tab_restore_service_)
129 tab_restore_service_->RemoveObserver(this); 127 tab_restore_service_->RemoveObserver(this);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 271 }
274 272
275 void HistoryMenuBridge::OnURLVisited(HistoryService* history_service, 273 void HistoryMenuBridge::OnURLVisited(HistoryService* history_service,
276 ui::PageTransition transition, 274 ui::PageTransition transition,
277 const history::URLRow& row, 275 const history::URLRow& row,
278 const history::RedirectList& redirects, 276 const history::RedirectList& redirects,
279 base::Time visit_time) { 277 base::Time visit_time) {
280 OnHistoryChanged(); 278 OnHistoryChanged();
281 } 279 }
282 280
281 void HistoryMenuBridge::OnURLsModified(HistoryService* history_service,
282 const history::URLRows& changed_urls) {
283 OnHistoryChanged();
284 }
285
283 HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForMenuItem( 286 HistoryMenuBridge::HistoryItem* HistoryMenuBridge::HistoryItemForMenuItem(
284 NSMenuItem* item) { 287 NSMenuItem* item) {
285 std::map<NSMenuItem*, HistoryItem*>::iterator it = menu_item_map_.find(item); 288 std::map<NSMenuItem*, HistoryItem*>::iterator it = menu_item_map_.find(item);
286 if (it != menu_item_map_.end()) { 289 if (it != menu_item_map_.end()) {
287 return it->second; 290 return it->second;
288 } 291 }
289 return NULL; 292 return NULL;
290 } 293 }
291 294
292 HistoryService* HistoryMenuBridge::service() { 295 HistoryService* HistoryMenuBridge::service() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 [item->menu_item setToolTip:tooltip]; 363 [item->menu_item setToolTip:tooltip];
361 364
362 [menu insertItem:item->menu_item.get() atIndex:index]; 365 [menu insertItem:item->menu_item.get() atIndex:index];
363 menu_item_map_.insert(std::make_pair(item->menu_item.get(), item)); 366 menu_item_map_.insert(std::make_pair(item->menu_item.get(), item));
364 367
365 return item->menu_item.get(); 368 return item->menu_item.get();
366 } 369 }
367 370
368 void HistoryMenuBridge::Init() { 371 void HistoryMenuBridge::Init() {
369 DCHECK(history_service_); 372 DCHECK(history_service_);
370 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_MODIFIED,
371 content::Source<Profile>(profile_));
372 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 373 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
373 content::Source<Profile>(profile_)); 374 content::Source<Profile>(profile_));
374 history_service_->AddObserver(this); 375 history_service_->AddObserver(this);
375 } 376 }
376 377
377 void HistoryMenuBridge::CreateMenu() { 378 void HistoryMenuBridge::CreateMenu() {
378 // If we're currently running CreateMenu(), wait until it finishes. 379 // If we're currently running CreateMenu(), wait until it finishes.
379 if (create_in_progress_) 380 if (create_in_progress_)
380 return; 381 return;
381 create_in_progress_ = true; 382 create_in_progress_ = true;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 478 }
478 479
479 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { 480 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) {
480 DCHECK(item); 481 DCHECK(item);
481 if (item->icon_requested) { 482 if (item->icon_requested) {
482 cancelable_task_tracker_.TryCancel(item->icon_task_id); 483 cancelable_task_tracker_.TryCancel(item->icon_task_id);
483 item->icon_requested = false; 484 item->icon_requested = false;
484 item->icon_task_id = base::CancelableTaskTracker::kBadTaskId; 485 item->icon_task_id = base::CancelableTaskTracker::kBadTaskId;
485 } 486 }
486 } 487 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/history_menu_bridge.h ('k') | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698