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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.cc

Issue 10827045: 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, 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/gtk/bookmarks/bookmark_menu_controller_gtk.cc ('k') | no next file » | 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) 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/gtk/bookmarks/bookmark_sub_menu_model_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/bookmarks/bookmark_model.h" 11 #include "chrome/browser/bookmarks/bookmark_model.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
12 #include "chrome/browser/event_disposition.h" 13 #include "chrome/browser/event_disposition.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 16 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
16 #include "chrome/browser/ui/gtk/menu_gtk.h" 17 #include "chrome/browser/ui/gtk/menu_gtk.h"
17 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
18 #include "ui/base/gtk/menu_label_accelerator_util.h" 19 #include "ui/base/gtk/menu_label_accelerator_util.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 21
21 using content::OpenURLParams; 22 using content::OpenURLParams;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 151 }
151 152
152 void BookmarkSubMenuModel::MenuWillShow() { 153 void BookmarkSubMenuModel::MenuWillShow() {
153 menu_showing_ = true; 154 menu_showing_ = true;
154 Clear(); 155 Clear();
155 AddCheckItemWithStringId(IDC_SHOW_BOOKMARK_BAR, IDS_SHOW_BOOKMARK_BAR); 156 AddCheckItemWithStringId(IDC_SHOW_BOOKMARK_BAR, IDS_SHOW_BOOKMARK_BAR);
156 AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER); 157 AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER);
157 AddItemWithStringId(IDC_IMPORT_SETTINGS, IDS_IMPORT_SETTINGS_MENU_LABEL); 158 AddItemWithStringId(IDC_IMPORT_SETTINGS, IDS_IMPORT_SETTINGS_MENU_LABEL);
158 fixed_items_ = bookmark_end_ = GetItemCount(); 159 fixed_items_ = bookmark_end_ = GetItemCount();
159 if (!model()) { 160 if (!model()) {
160 set_model(browser_->profile()->GetBookmarkModel()); 161 set_model(BookmarkModelFactory::GetForProfile(browser_->profile()));
161 if (!model()) 162 if (!model())
162 return; 163 return;
163 model()->AddObserver(this); 164 model()->AddObserver(this);
164 } 165 }
165 // We can't do anything further if the model isn't loaded yet. 166 // We can't do anything further if the model isn't loaded yet.
166 if (!model()->IsLoaded()) 167 if (!model()->IsLoaded())
167 return; 168 return;
168 // The node count includes the node itself, so 1 means empty. 169 // The node count includes the node itself, so 1 means empty.
169 if (model()->bookmark_bar_node()->GetTotalNodeCount() > 1) { 170 if (model()->bookmark_bar_node()->GetTotalNodeCount() > 1) {
170 AddSeparator(); 171 AddSeparator();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 221
221 bool BookmarkSubMenuModel::IsVisibleAt(int index) const { 222 bool BookmarkSubMenuModel::IsVisibleAt(int index) const {
222 // We don't want the delegate interfering with bookmark items. 223 // We don't want the delegate interfering with bookmark items.
223 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index); 224 return index >= fixed_items_ || SimpleMenuModel::IsVisibleAt(index);
224 } 225 }
225 226
226 // static 227 // static
227 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) { 228 bool BookmarkSubMenuModel::IsBookmarkItemCommandId(int command_id) {
228 return command_id == kBookmarkItemCommandId; 229 return command_id == kBookmarkItemCommandId;
229 } 230 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698