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

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

Issue 12340111: Introduce //components/user_prefs, use to eliminate c/b/prefs dependency in Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge of LKGR Created 7 years, 9 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/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
16 #include "chrome/browser/bookmarks/bookmark_utils.h" 16 #include "chrome/browser/bookmarks/bookmark_utils.h"
17 #include "chrome/browser/history/history_service.h" 17 #include "chrome/browser/history/history_service.h"
18 #include "chrome/browser/net/url_fixer_upper.h" 18 #include "chrome/browser/net/url_fixer_upper.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 20 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
21 #include "components/user_prefs/user_prefs.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/locale_settings.h" 25 #include "grit/locale_settings.h"
25 #include "ui/base/events/event.h" 26 #include "ui/base/events/event.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/views/background.h" 28 #include "ui/views/background.h"
28 #include "ui/views/controls/button/label_button.h" 29 #include "ui/views/controls/button/label_button.h"
29 #include "ui/views/controls/label.h" 30 #include "ui/views/controls/label.h"
30 #include "ui/views/controls/menu/menu_model_adapter.h" 31 #include "ui/views/controls/menu/menu_model_adapter.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 layout->StartRow(0, labels_column_set_id); 329 layout->StartRow(0, labels_column_set_id);
329 layout->AddView(title_label_); 330 layout->AddView(title_label_);
330 layout->AddView(title_tf_); 331 layout->AddView(title_tf_);
331 332
332 if (details_.GetNodeType() != BookmarkNode::FOLDER) { 333 if (details_.GetNodeType() != BookmarkNode::FOLDER) {
333 url_label_ = new views::Label( 334 url_label_ = new views::Label(
334 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); 335 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL));
335 336
336 url_tf_ = new views::Textfield; 337 url_tf_ = new views::Textfield;
337 PrefService* prefs = profile_ ? 338 PrefService* prefs = profile_ ?
338 PrefServiceFromBrowserContext(profile_) : 339 components::UserPrefs::Get(profile_) :
339 NULL; 340 NULL;
340 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); 341 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs));
341 url_tf_->SetController(this); 342 url_tf_->SetController(this);
342 url_tf_->SetAccessibleName(url_label_->text()); 343 url_tf_->SetAccessibleName(url_label_->text());
343 344
344 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 345 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
345 346
346 layout->StartRow(0, labels_column_set_id); 347 layout->StartRow(0, labels_column_set_id);
347 layout->AddView(url_label_); 348 layout->AddView(url_label_);
348 layout->AddView(url_tf_); 349 layout->AddView(url_tf_);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); 619 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM);
619 } 620 }
620 return context_menu_model_.get(); 621 return context_menu_model_.get();
621 } 622 }
622 623
623 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, 624 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node,
624 const string16& title) { 625 const string16& title) {
625 if (!title.empty()) 626 if (!title.empty())
626 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 627 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
627 } 628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698