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/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_utils.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/url_fixer/url_fixer.h" | 23 #include "components/url_formatter/url_fixer.h" |
24 #include "components/user_prefs/user_prefs.h" | 24 #include "components/user_prefs/user_prefs.h" |
25 #include "ui/accessibility/ax_view_state.h" | 25 #include "ui/accessibility/ax_view_state.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
28 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
29 #include "ui/views/controls/button/label_button.h" | 29 #include "ui/views/controls/button/label_button.h" |
30 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
31 #include "ui/views/controls/menu/menu_runner.h" | 31 #include "ui/views/controls/menu/menu_runner.h" |
32 #include "ui/views/controls/textfield/textfield.h" | 32 #include "ui/views/controls/textfield/textfield.h" |
33 #include "ui/views/controls/tree/tree_view.h" | 33 #include "ui/views/controls/tree/tree_view.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 context_menu_runner_.reset(); | 434 context_menu_runner_.reset(); |
435 | 435 |
436 if (parent()) | 436 if (parent()) |
437 ExpandAndSelect(); | 437 ExpandAndSelect(); |
438 } | 438 } |
439 | 439 |
440 GURL BookmarkEditorView::GetInputURL() const { | 440 GURL BookmarkEditorView::GetInputURL() const { |
441 if (details_.GetNodeType() == BookmarkNode::FOLDER) | 441 if (details_.GetNodeType() == BookmarkNode::FOLDER) |
442 return GURL(); | 442 return GURL(); |
443 return url_fixer::FixupURL(base::UTF16ToUTF8(url_tf_->text()), std::string()); | 443 return url_formatter::FixupURL(base::UTF16ToUTF8(url_tf_->text()), |
| 444 std::string()); |
444 } | 445 } |
445 | 446 |
446 void BookmarkEditorView::UserInputChanged() { | 447 void BookmarkEditorView::UserInputChanged() { |
447 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 448 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
448 const GURL url(GetInputURL()); | 449 const GURL url(GetInputURL()); |
449 if (!url.is_valid()) | 450 if (!url.is_valid()) |
450 url_tf_->SetBackgroundColor(kErrorColor); | 451 url_tf_->SetBackgroundColor(kErrorColor); |
451 else | 452 else |
452 url_tf_->UseDefaultBackgroundColor(); | 453 url_tf_->UseDefaultBackgroundColor(); |
453 } | 454 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 } | 647 } |
647 return context_menu_model_.get(); | 648 return context_menu_model_.get(); |
648 } | 649 } |
649 | 650 |
650 void BookmarkEditorView::EditorTreeModel::SetTitle( | 651 void BookmarkEditorView::EditorTreeModel::SetTitle( |
651 ui::TreeModelNode* node, | 652 ui::TreeModelNode* node, |
652 const base::string16& title) { | 653 const base::string16& title) { |
653 if (!title.empty()) | 654 if (!title.empty()) |
654 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 655 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
655 } | 656 } |
OLD | NEW |