| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/search/search.h" | 27 #include "chrome/browser/search/search.h" |
| 28 #include "chrome/browser/sync/profile_sync_service.h" | 28 #include "chrome/browser/sync/profile_sync_service.h" |
| 29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 30 #include "chrome/browser/themes/theme_properties.h" | 30 #include "chrome/browser/themes/theme_properties.h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" | 32 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" |
| 33 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 33 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 34 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 34 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 35 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
| 36 #include "chrome/browser/ui/chrome_pages.h" | 36 #include "chrome/browser/ui/chrome_pages.h" |
| 37 #include "chrome/browser/ui/elide_url.h" | |
| 38 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 37 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 39 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 38 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 40 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 39 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 41 #include "chrome/browser/ui/view_ids.h" | 40 #include "chrome/browser/ui/view_ids.h" |
| 42 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 41 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
| 43 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h" | 42 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h" |
| 44 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" | 43 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
| 45 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" | 44 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.h" |
| 46 #include "chrome/browser/ui/views/event_utils.h" | 45 #include "chrome/browser/ui/views/event_utils.h" |
| 47 #include "chrome/browser/ui/views/frame/browser_view.h" | 46 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 48 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 47 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 49 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
| 50 #include "chrome/common/extensions/extension_constants.h" | 49 #include "chrome/common/extensions/extension_constants.h" |
| 51 #include "chrome/common/extensions/extension_metrics.h" | 50 #include "chrome/common/extensions/extension_metrics.h" |
| 52 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 53 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
| 54 #include "chrome/grit/generated_resources.h" | 53 #include "chrome/grit/generated_resources.h" |
| 55 #include "components/bookmarks/browser/bookmark_model.h" | 54 #include "components/bookmarks/browser/bookmark_model.h" |
| 56 #include "components/bookmarks/browser/bookmark_utils.h" | 55 #include "components/bookmarks/browser/bookmark_utils.h" |
| 57 #include "components/bookmarks/managed/managed_bookmark_service.h" | 56 #include "components/bookmarks/managed/managed_bookmark_service.h" |
| 58 #include "components/metrics/metrics_service.h" | 57 #include "components/metrics/metrics_service.h" |
| 58 #include "components/secure_display/elide_url.h" |
| 59 #include "content/public/browser/notification_details.h" | 59 #include "content/public/browser/notification_details.h" |
| 60 #include "content/public/browser/notification_source.h" | 60 #include "content/public/browser/notification_source.h" |
| 61 #include "content/public/browser/page_navigator.h" | 61 #include "content/public/browser/page_navigator.h" |
| 62 #include "content/public/browser/render_view_host.h" | 62 #include "content/public/browser/render_view_host.h" |
| 63 #include "content/public/browser/render_widget_host_view.h" | 63 #include "content/public/browser/render_widget_host_view.h" |
| 64 #include "content/public/browser/user_metrics.h" | 64 #include "content/public/browser/user_metrics.h" |
| 65 #include "content/public/browser/web_contents.h" | 65 #include "content/public/browser/web_contents.h" |
| 66 #include "extensions/browser/extension_registry.h" | 66 #include "extensions/browser/extension_registry.h" |
| 67 #include "extensions/common/extension.h" | 67 #include "extensions/common/extension.h" |
| 68 #include "extensions/common/extension_set.h" | 68 #include "extensions/common/extension_set.h" |
| (...skipping 645 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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 return; | 2075 return; |
| 2075 apps_page_shortcut_->SetVisible(visible); | 2076 apps_page_shortcut_->SetVisible(visible); |
| 2076 UpdateBookmarksSeparatorVisibility(); | 2077 UpdateBookmarksSeparatorVisibility(); |
| 2077 LayoutAndPaint(); | 2078 LayoutAndPaint(); |
| 2078 } | 2079 } |
| 2079 | 2080 |
| 2080 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2081 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2081 if (UpdateOtherAndManagedButtonsVisibility()) | 2082 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2082 LayoutAndPaint(); | 2083 LayoutAndPaint(); |
| 2083 } | 2084 } |
| OLD | NEW |