| 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/location_bar/location_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 8 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| 9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
| 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 11 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" | 11 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 14 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/components_scaled_resources.h" | 16 #include "grit/components_scaled_resources.h" |
| 17 #include "grit/theme_resources.h" | 17 #include "grit/theme_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/material_design/material_design_controller.h" | 19 #include "ui/base/material_design/material_design_controller.h" |
| 20 #include "ui/gfx/color_palette.h" | 20 #include "ui/gfx/color_palette.h" |
| 21 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
| 22 #include "ui/views/painter.h" | 22 #include "ui/views/painter.h" |
| 23 #include "ui/views/style/platform_style.h" |
| 23 | 24 |
| 24 using content::NavigationController; | 25 using content::NavigationController; |
| 25 using content::NavigationEntry; | 26 using content::NavigationEntry; |
| 26 using content::WebContents; | 27 using content::WebContents; |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 void ProcessEventInternal(LocationBarView* view) { | 31 void ProcessEventInternal(LocationBarView* view) { |
| 31 WebContents* contents = view->GetWebContents(); | 32 WebContents* contents = view->GetWebContents(); |
| 32 if (!contents) | 33 if (!contents) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 LocationIconView::LocationIconView(const gfx::FontList& font_list, | 52 LocationIconView::LocationIconView(const gfx::FontList& font_list, |
| 52 SkColor parent_background_color, | 53 SkColor parent_background_color, |
| 53 LocationBarView* location_bar) | 54 LocationBarView* location_bar) |
| 54 : IconLabelBubbleView(IDR_OMNIBOX_HTTPS_INVALID, | 55 : IconLabelBubbleView(IDR_OMNIBOX_HTTPS_INVALID, |
| 55 font_list, | 56 font_list, |
| 56 parent_background_color, | 57 parent_background_color, |
| 57 true), | 58 true), |
| 58 suppress_mouse_released_action_(false), | 59 suppress_mouse_released_action_(false), |
| 59 location_bar_(location_bar) { | 60 location_bar_(location_bar) { |
| 60 set_id(VIEW_ID_LOCATION_ICON); | 61 set_id(VIEW_ID_LOCATION_ICON); |
| 61 SetFocusable(true); | 62 views::PlatformStyle::ConfigureFocus(views::PlatformStyle::CONTROL::ICON, |
| 63 this); |
| 62 SetBackground(false); | 64 SetBackground(false); |
| 63 } | 65 } |
| 64 | 66 |
| 65 LocationIconView::~LocationIconView() { | 67 LocationIconView::~LocationIconView() { |
| 66 } | 68 } |
| 67 | 69 |
| 68 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { | 70 bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { |
| 69 if (event.IsOnlyMiddleMouseButton() && | 71 if (event.IsOnlyMiddleMouseButton() && |
| 70 ui::Clipboard::IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) { | 72 ui::Clipboard::IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) { |
| 71 base::string16 text; | 73 base::string16 text; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return size; | 173 return size; |
| 172 } | 174 } |
| 173 | 175 |
| 174 void LocationIconView::SetBackground(bool should_show_ev) { | 176 void LocationIconView::SetBackground(bool should_show_ev) { |
| 175 static const int kEvBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); | 177 static const int kEvBackgroundImages[] = IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE); |
| 176 if (should_show_ev) | 178 if (should_show_ev) |
| 177 SetBackgroundImageGrid(kEvBackgroundImages); | 179 SetBackgroundImageGrid(kEvBackgroundImages); |
| 178 else | 180 else |
| 179 UnsetBackgroundImageGrid(); | 181 UnsetBackgroundImageGrid(); |
| 180 } | 182 } |
| OLD | NEW |