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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 14 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
15 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" | 15 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" |
16 #include "chrome/browser/ui/browser_dialogs.h" | 16 #include "chrome/browser/ui/browser_dialogs.h" |
17 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
18 #include "chrome/grit/locale_settings.h" | 18 #include "chrome/grit/locale_settings.h" |
19 #include "components/bookmarks/browser/bookmark_model.h" | 19 #include "components/bookmarks/browser/bookmark_model.h" |
20 #include "components/bookmarks/browser/bookmark_utils.h" | 20 #include "components/bookmarks/browser/bookmark_utils.h" |
21 #include "components/constrained_window/constrained_window_views.h" | 21 #include "components/constrained_window/constrained_window_views.h" |
22 #include "components/history/core/browser/history_service.h" | 22 #include "components/history/core/browser/history_service.h" |
23 #include "components/prefs/pref_service.h" | |
24 #include "components/url_formatter/url_fixer.h" | 23 #include "components/url_formatter/url_fixer.h" |
25 #include "components/user_prefs/user_prefs.h" | 24 #include "components/user_prefs/user_prefs.h" |
26 #include "grit/components_strings.h" | 25 #include "grit/components_strings.h" |
27 #include "ui/accessibility/ax_view_state.h" | 26 #include "ui/accessibility/ax_view_state.h" |
28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
30 #include "ui/views/background.h" | 29 #include "ui/views/background.h" |
31 #include "ui/views/controls/button/label_button.h" | 30 #include "ui/views/controls/button/label_button.h" |
32 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
33 #include "ui/views/controls/menu/menu_runner.h" | 32 #include "ui/views/controls/menu/menu_runner.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 369 |
371 layout->StartRow(0, labels_column_set_id); | 370 layout->StartRow(0, labels_column_set_id); |
372 layout->AddView(title_label_); | 371 layout->AddView(title_label_); |
373 layout->AddView(title_tf_); | 372 layout->AddView(title_tf_); |
374 | 373 |
375 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 374 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
376 url_label_ = new views::Label( | 375 url_label_ = new views::Label( |
377 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); | 376 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); |
378 | 377 |
379 url_tf_ = new views::Textfield; | 378 url_tf_ = new views::Textfield; |
380 PrefService* prefs = | 379 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url)); |
381 profile_ ? user_prefs::UserPrefs::Get(profile_) : NULL; | |
382 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); | |
383 url_tf_->set_controller(this); | 380 url_tf_->set_controller(this); |
384 url_tf_->SetAccessibleName( | 381 url_tf_->SetAccessibleName( |
385 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_URL_LABEL)); | 382 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_URL_LABEL)); |
386 | 383 |
387 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 384 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
388 | 385 |
389 layout->StartRow(0, labels_column_set_id); | 386 layout->StartRow(0, labels_column_set_id); |
390 layout->AddView(url_label_); | 387 layout->AddView(url_label_); |
391 layout->AddView(url_tf_); | 388 layout->AddView(url_tf_); |
392 } | 389 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 Profile* profile, | 649 Profile* profile, |
653 const BookmarkEditor::EditDetails& details, | 650 const BookmarkEditor::EditDetails& details, |
654 BookmarkEditor::Configuration configuration) { | 651 BookmarkEditor::Configuration configuration) { |
655 DCHECK(profile); | 652 DCHECK(profile); |
656 BookmarkEditorView* editor = new BookmarkEditorView( | 653 BookmarkEditorView* editor = new BookmarkEditorView( |
657 profile, details.parent_node, details, configuration); | 654 profile, details.parent_node, details, configuration); |
658 editor->Show(parent_window); | 655 editor->Show(parent_window); |
659 } | 656 } |
660 | 657 |
661 } // namespace chrome | 658 } // namespace chrome |
OLD | NEW |