OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 49 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
52 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
53 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
54 #include "chrome/grit/chromium_strings.h" | 54 #include "chrome/grit/chromium_strings.h" |
55 #include "chrome/grit/theme_resources.h" | 55 #include "chrome/grit/theme_resources.h" |
56 #include "components/bookmarks/common/bookmark_pref_names.h" | 56 #include "components/bookmarks/common/bookmark_pref_names.h" |
57 #include "components/grit/components_scaled_resources.h" | 57 #include "components/grit/components_scaled_resources.h" |
58 #import "components/omnibox/browser/omnibox_popup_model.h" | 58 #import "components/omnibox/browser/omnibox_popup_model.h" |
59 #include "components/omnibox/browser/vector_icons.h" | |
60 #include "components/prefs/pref_service.h" | 59 #include "components/prefs/pref_service.h" |
61 #include "components/search_engines/template_url.h" | 60 #include "components/search_engines/template_url.h" |
62 #include "components/search_engines/template_url_service.h" | 61 #include "components/search_engines/template_url_service.h" |
63 #include "components/toolbar/vector_icons.h" | 62 #include "components/toolbar/vector_icons.h" |
64 #include "components/translate/core/browser/language_state.h" | 63 #include "components/translate/core/browser/language_state.h" |
65 #include "components/variations/variations_associated_data.h" | 64 #include "components/variations/variations_associated_data.h" |
66 #include "components/zoom/zoom_controller.h" | 65 #include "components/zoom/zoom_controller.h" |
67 #include "components/zoom/zoom_event_manager.h" | 66 #include "components/zoom/zoom_event_manager.h" |
68 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" |
69 #include "content/public/common/url_constants.h" | 68 #include "content/public/common/url_constants.h" |
70 #include "extensions/browser/extension_system.h" | 69 #include "extensions/browser/extension_system.h" |
71 #include "extensions/common/extension.h" | 70 #include "extensions/common/extension.h" |
72 #include "skia/ext/skia_utils_mac.h" | 71 #include "skia/ext/skia_utils_mac.h" |
73 #import "ui/base/cocoa/cocoa_base_utils.h" | 72 #import "ui/base/cocoa/cocoa_base_utils.h" |
74 #include "ui/base/l10n/l10n_util_mac.h" | 73 #include "ui/base/l10n/l10n_util_mac.h" |
75 #include "ui/base/material_design/material_design_controller.h" | 74 #include "ui/base/material_design/material_design_controller.h" |
76 #include "ui/gfx/color_palette.h" | 75 #include "ui/gfx/color_palette.h" |
77 #include "ui/gfx/color_utils.h" | 76 #include "ui/gfx/color_utils.h" |
78 #include "ui/gfx/image/image.h" | 77 #include "ui/gfx/image/image.h" |
79 #include "ui/gfx/image/image_skia_util_mac.h" | 78 #include "ui/gfx/image/image_skia_util_mac.h" |
80 #include "ui/gfx/paint_vector_icon.h" | 79 #include "ui/gfx/paint_vector_icon.h" |
| 80 #include "ui/vector_icons/vector_icons.h" |
81 | 81 |
82 using content::WebContents; | 82 using content::WebContents; |
83 | 83 |
84 namespace { | 84 namespace { |
85 | 85 |
86 // Vertical space between the bottom edge of the location_bar and the first run | 86 // Vertical space between the bottom edge of the location_bar and the first run |
87 // bubble arrow point. | 87 // bubble arrow point. |
88 const static int kFirstRunBubbleYOffset = 1; | 88 const static int kFirstRunBubbleYOffset = 1; |
89 | 89 |
90 const int kDefaultIconSize = 16; | 90 const int kDefaultIconSize = 16; |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 profile())->GetTemplateURLForKeyword(keyword); | 698 profile())->GetTemplateURLForKeyword(keyword); |
699 if (template_url && | 699 if (template_url && |
700 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 700 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
701 return extensions::OmniboxAPI::Get(profile())-> | 701 return extensions::OmniboxAPI::Get(profile())-> |
702 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); | 702 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); |
703 } | 703 } |
704 | 704 |
705 SkColor icon_color = | 705 SkColor icon_color = |
706 IsLocationBarDark() ? kMaterialDarkVectorIconColor : gfx::kGoogleBlue700; | 706 IsLocationBarDark() ? kMaterialDarkVectorIconColor : gfx::kGoogleBlue700; |
707 return NSImageFromImageSkiaWithColorSpace( | 707 return NSImageFromImageSkiaWithColorSpace( |
708 gfx::CreateVectorIcon(omnibox::kSearchIcon, kDefaultIconSize, icon_color), | 708 gfx::CreateVectorIcon(ui::kSearchIcon, kDefaultIconSize, icon_color), |
709 base::mac::GetSRGBColorSpace()); | 709 base::mac::GetSRGBColorSpace()); |
710 } | 710 } |
711 | 711 |
712 SkColor LocationBarViewMac::GetLocationBarIconColor() const { | 712 SkColor LocationBarViewMac::GetLocationBarIconColor() const { |
713 bool in_dark_mode = IsLocationBarDark(); | 713 bool in_dark_mode = IsLocationBarDark(); |
714 if (in_dark_mode) | 714 if (in_dark_mode) |
715 return kMaterialDarkVectorIconColor; | 715 return kMaterialDarkVectorIconColor; |
716 | 716 |
717 if (ShouldShowEVBubble()) | 717 if (ShouldShowEVBubble()) |
718 return gfx::kGoogleGreen700; | 718 return gfx::kGoogleGreen700; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 OnDecorationsChanged(); | 945 OnDecorationsChanged(); |
946 } | 946 } |
947 | 947 |
948 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { | 948 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { |
949 std::vector<LocationBarDecoration*> decorations = GetDecorations(); | 949 std::vector<LocationBarDecoration*> decorations = GetDecorations(); |
950 std::vector<NSView*> views; | 950 std::vector<NSView*> views; |
951 for (auto* decoration : decorations) | 951 for (auto* decoration : decorations) |
952 views.push_back(decoration->GetAccessibilityView()); | 952 views.push_back(decoration->GetAccessibilityView()); |
953 return views; | 953 return views; |
954 } | 954 } |
OLD | NEW |