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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc

Issue 10827047: 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
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/views/bookmarks/bookmark_editor_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/bookmarks/bookmark_model.h" 13 #include "chrome/browser/bookmarks/bookmark_model.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
14 #include "chrome/browser/bookmarks/bookmark_utils.h" 15 #include "chrome/browser/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/history/history.h" 16 #include "chrome/browser/history/history.h"
16 #include "chrome/browser/net/url_fixer_upper.h" 17 #include "chrome/browser/net/url_fixer_upper.h"
17 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
21 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "grit/locale_settings.h" 24 #include "grit/locale_settings.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 views::MenuModelAdapter adapter(GetMenuModel()); 282 views::MenuModelAdapter adapter(GetMenuModel());
282 context_menu_runner_.reset(new views::MenuRunner(adapter.CreateMenu())); 283 context_menu_runner_.reset(new views::MenuRunner(adapter.CreateMenu()));
283 284
284 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), 285 if (context_menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(),
285 NULL, gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPRIGHT, 286 NULL, gfx::Rect(point, gfx::Size()), views::MenuItemView::TOPRIGHT,
286 views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED) 287 views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED)
287 return; 288 return;
288 } 289 }
289 290
290 void BookmarkEditorView::Init() { 291 void BookmarkEditorView::Init() {
291 bb_model_ = profile_->GetBookmarkModel(); 292 bb_model_ = BookmarkModelFactory::GetForProfile(profile_);
292 DCHECK(bb_model_); 293 DCHECK(bb_model_);
293 bb_model_->AddObserver(this); 294 bb_model_->AddObserver(this);
294 295
295 title_label_ = new views::Label( 296 title_label_ = new views::Label(
296 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); 297 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL));
297 298
298 string16 title; 299 string16 title;
299 GURL url; 300 GURL url;
300 if (details_.type == EditDetails::EXISTING_NODE) { 301 if (details_.type == EditDetails::EXISTING_NODE) {
301 title = details_.existing_node->GetTitle(); 302 title = details_.existing_node->GetTitle();
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); 655 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM);
655 } 656 }
656 return context_menu_model_.get(); 657 return context_menu_model_.get();
657 } 658 }
658 659
659 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, 660 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node,
660 const string16& title) { 661 const string16& title) {
661 if (!title.empty()) 662 if (!title.empty())
662 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 663 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
663 } 664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698