| 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_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/search/search.h" | 28 #include "chrome/browser/search/search.h" |
| 29 #include "chrome/browser/sync/profile_sync_service.h" | 29 #include "chrome/browser/sync/profile_sync_service.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 31 #include "chrome/browser/themes/theme_properties.h" | 31 #include "chrome/browser/themes/theme_properties.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 32 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 33 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" | 33 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" |
| 34 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 34 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 35 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 35 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 36 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
| 37 #include "chrome/browser/ui/chrome_pages.h" | 37 #include "chrome/browser/ui/chrome_pages.h" |
| 38 #include "chrome/browser/ui/elide_url.h" | |
| 39 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 38 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 40 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 39 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 41 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 40 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 42 #include "chrome/browser/ui/view_ids.h" | 41 #include "chrome/browser/ui/view_ids.h" |
| 43 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 42 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
| 44 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h" | 43 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h" |
| 45 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" | 44 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
| 46 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" | 45 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" |
| 47 #include "chrome/browser/ui/views/event_utils.h" | 46 #include "chrome/browser/ui/views/event_utils.h" |
| 48 #include "chrome/browser/ui/views/frame/browser_view.h" | 47 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 74 #include "ui/base/page_transition_types.h" | 73 #include "ui/base/page_transition_types.h" |
| 75 #include "ui/base/resource/resource_bundle.h" | 74 #include "ui/base/resource/resource_bundle.h" |
| 76 #include "ui/base/theme_provider.h" | 75 #include "ui/base/theme_provider.h" |
| 77 #include "ui/base/window_open_disposition.h" | 76 #include "ui/base/window_open_disposition.h" |
| 78 #include "ui/compositor/paint_recorder.h" | 77 #include "ui/compositor/paint_recorder.h" |
| 79 #include "ui/gfx/animation/slide_animation.h" | 78 #include "ui/gfx/animation/slide_animation.h" |
| 80 #include "ui/gfx/canvas.h" | 79 #include "ui/gfx/canvas.h" |
| 81 #include "ui/gfx/text_constants.h" | 80 #include "ui/gfx/text_constants.h" |
| 82 #include "ui/gfx/text_elider.h" | 81 #include "ui/gfx/text_elider.h" |
| 83 #include "ui/resources/grit/ui_resources.h" | 82 #include "ui/resources/grit/ui_resources.h" |
| 83 #include "ui/secure_display/elide_url.h" |
| 84 #include "ui/views/button_drag_utils.h" | 84 #include "ui/views/button_drag_utils.h" |
| 85 #include "ui/views/controls/button/label_button.h" | 85 #include "ui/views/controls/button/label_button.h" |
| 86 #include "ui/views/controls/button/label_button_border.h" | 86 #include "ui/views/controls/button/label_button_border.h" |
| 87 #include "ui/views/controls/button/menu_button.h" | 87 #include "ui/views/controls/button/menu_button.h" |
| 88 #include "ui/views/controls/label.h" | 88 #include "ui/views/controls/label.h" |
| 89 #include "ui/views/drag_utils.h" | 89 #include "ui/views/drag_utils.h" |
| 90 #include "ui/views/metrics.h" | 90 #include "ui/views/metrics.h" |
| 91 #include "ui/views/view_constants.h" | 91 #include "ui/views/view_constants.h" |
| 92 #include "ui/views/widget/tooltip_manager.h" | 92 #include "ui/views/widget/tooltip_manager.h" |
| 93 #include "ui/views/widget/widget.h" | 93 #include "ui/views/widget/widget.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 result.push_back('\n'); | 714 result.push_back('\n'); |
| 715 | 715 |
| 716 // We need to explicitly specify the directionality of the URL's text to | 716 // We need to explicitly specify the directionality of the URL's text to |
| 717 // make sure it is treated as an LTR string when the context is RTL. For | 717 // make sure it is treated as an LTR string when the context is RTL. For |
| 718 // example, the URL "http://www.yahoo.com/" appears as | 718 // example, the URL "http://www.yahoo.com/" appears as |
| 719 // "/http://www.yahoo.com" when rendered, as is, in an RTL context since | 719 // "/http://www.yahoo.com" when rendered, as is, in an RTL context since |
| 720 // the Unicode BiDi algorithm puts certain characters on the left by | 720 // the Unicode BiDi algorithm puts certain characters on the left by |
| 721 // default. | 721 // default. |
| 722 std::string languages = profile->GetPrefs()->GetString( | 722 std::string languages = profile->GetPrefs()->GetString( |
| 723 prefs::kAcceptLanguages); | 723 prefs::kAcceptLanguages); |
| 724 base::string16 elided_url(ElideUrl(url, tt_fonts, max_width, languages)); | 724 base::string16 elided_url( |
| 725 secure_display::ElideUrl(url, tt_fonts, max_width, languages)); |
| 725 elided_url = base::i18n::GetDisplayStringInLTRDirectionality(elided_url); | 726 elided_url = base::i18n::GetDisplayStringInLTRDirectionality(elided_url); |
| 726 result.append(elided_url); | 727 result.append(elided_url); |
| 727 } | 728 } |
| 728 return result; | 729 return result; |
| 729 } | 730 } |
| 730 | 731 |
| 731 bool BookmarkBarView::IsDetached() const { | 732 bool BookmarkBarView::IsDetached() const { |
| 732 return (bookmark_bar_state_ == BookmarkBar::DETACHED) || | 733 return (bookmark_bar_state_ == BookmarkBar::DETACHED) || |
| 733 (animating_detached_ && size_animation_->is_animating()); | 734 (animating_detached_ && size_animation_->is_animating()); |
| 734 } | 735 } |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 return; | 2074 return; |
| 2074 apps_page_shortcut_->SetVisible(visible); | 2075 apps_page_shortcut_->SetVisible(visible); |
| 2075 UpdateBookmarksSeparatorVisibility(); | 2076 UpdateBookmarksSeparatorVisibility(); |
| 2076 LayoutAndPaint(); | 2077 LayoutAndPaint(); |
| 2077 } | 2078 } |
| 2078 | 2079 |
| 2079 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2080 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2080 if (UpdateOtherAndManagedButtonsVisibility()) | 2081 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2081 LayoutAndPaint(); | 2082 LayoutAndPaint(); |
| 2082 } | 2083 } |
| OLD | NEW |