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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.mm

Issue 10827060: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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) 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 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
11 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" 15 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h"
16 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
17 #include "grit/theme_resources.h" 18 #include "grit/theme_resources.h"
18 #include "grit/ui_resources.h" 19 #include "grit/ui_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void BookmarkMenuBridge::ObserveBookmarkModel() { 165 void BookmarkMenuBridge::ObserveBookmarkModel() {
165 BookmarkModel* model = GetBookmarkModel(); 166 BookmarkModel* model = GetBookmarkModel();
166 model->AddObserver(this); 167 model->AddObserver(this);
167 if (model->IsLoaded()) 168 if (model->IsLoaded())
168 Loaded(model, false); 169 Loaded(model, false);
169 } 170 }
170 171
171 BookmarkModel* BookmarkMenuBridge::GetBookmarkModel() { 172 BookmarkModel* BookmarkMenuBridge::GetBookmarkModel() {
172 if (!profile_) 173 if (!profile_)
173 return NULL; 174 return NULL;
174 return profile_->GetBookmarkModel(); 175 return BookmarkModelFactory::GetForProfile(profile_);
175 } 176 }
176 177
177 Profile* BookmarkMenuBridge::GetProfile() { 178 Profile* BookmarkMenuBridge::GetProfile() {
178 return profile_; 179 return profile_;
179 } 180 }
180 181
181 void BookmarkMenuBridge::ClearBookmarkMenu(NSMenu* menu) { 182 void BookmarkMenuBridge::ClearBookmarkMenu(NSMenu* menu) {
182 bookmark_nodes_.clear(); 183 bookmark_nodes_.clear();
183 // Recursively delete all menus that look like a bookmark. Also delete all 184 // Recursively delete all menus that look like a bookmark. Also delete all
184 // separator items since we explicitly add them back in. This deletes 185 // separator items since we explicitly add them back in. This deletes
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 320
320 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) { 321 NSMenuItem* BookmarkMenuBridge::MenuItemForNode(const BookmarkNode* node) {
321 if (!node) 322 if (!node)
322 return nil; 323 return nil;
323 std::map<const BookmarkNode*, NSMenuItem*>::iterator it = 324 std::map<const BookmarkNode*, NSMenuItem*>::iterator it =
324 bookmark_nodes_.find(node); 325 bookmark_nodes_.find(node);
325 if (it == bookmark_nodes_.end()) 326 if (it == bookmark_nodes_.end())
326 return nil; 327 return nil;
327 return it->second; 328 return it->second;
328 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698