OLD | NEW |
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/chrome_style.h" | 29 #include "ui/views/controls/button/chrome_style.h" |
29 #include "ui/views/controls/button/text_button.h" | 30 #include "ui/views/controls/button/text_button.h" |
30 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 layout->StartRow(0, labels_column_set_id); | 331 layout->StartRow(0, labels_column_set_id); |
331 layout->AddView(title_label_); | 332 layout->AddView(title_label_); |
332 layout->AddView(title_tf_); | 333 layout->AddView(title_tf_); |
333 | 334 |
334 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 335 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
335 url_label_ = new views::Label( | 336 url_label_ = new views::Label( |
336 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); | 337 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); |
337 | 338 |
338 url_tf_ = new views::Textfield; | 339 url_tf_ = new views::Textfield; |
339 PrefService* prefs = profile_ ? | 340 PrefService* prefs = profile_ ? |
340 PrefServiceFromBrowserContext(profile_) : | 341 components::UserPrefs::Get(profile_) : |
341 NULL; | 342 NULL; |
342 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); | 343 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); |
343 url_tf_->SetController(this); | 344 url_tf_->SetController(this); |
344 url_tf_->SetAccessibleName(url_label_->text()); | 345 url_tf_->SetAccessibleName(url_label_->text()); |
345 | 346 |
346 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 347 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
347 | 348 |
348 layout->StartRow(0, labels_column_set_id); | 349 layout->StartRow(0, labels_column_set_id); |
349 layout->AddView(url_label_); | 350 layout->AddView(url_label_); |
350 layout->AddView(url_tf_); | 351 layout->AddView(url_tf_); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); | 621 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); |
621 } | 622 } |
622 return context_menu_model_.get(); | 623 return context_menu_model_.get(); |
623 } | 624 } |
624 | 625 |
625 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 626 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
626 const string16& title) { | 627 const string16& title) { |
627 if (!title.empty()) | 628 if (!title.empty()) |
628 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 629 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
629 } | 630 } |
OLD | NEW |