| 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_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h" | 36 #include "chrome/browser/ui/views/location_bar/chrome_to_mobile_view.h" |
| 37 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 37 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
| 38 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 38 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
| 39 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 39 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 40 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 40 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 41 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 41 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 42 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 42 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 43 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 43 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 44 #include "chrome/browser/ui/views/location_bar/star_view.h" | 44 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 45 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | 45 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" |
| 46 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 46 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 47 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 47 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | |
| 48 #include "chrome/common/chrome_notification_types.h" | 48 #include "chrome/common/chrome_notification_types.h" |
| 49 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
| 50 #include "chrome/common/extensions/extension_switch_utils.h" | 50 #include "chrome/common/extensions/extension_switch_utils.h" |
| 51 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 52 #include "content/public/browser/notification_service.h" | 52 #include "content/public/browser/notification_service.h" |
| 53 #include "content/public/browser/render_widget_host_view.h" | 53 #include "content/public/browser/render_widget_host_view.h" |
| 54 #include "content/public/browser/web_contents.h" | 54 #include "content/public/browser/web_contents.h" |
| 55 #include "grit/generated_resources.h" | 55 #include "grit/generated_resources.h" |
| 56 #include "grit/theme_resources.h" | 56 #include "grit/theme_resources.h" |
| 57 #include "grit/theme_resources_standard.h" | 57 #include "grit/theme_resources_standard.h" |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 799 } |
| 800 // When used in the app launcher, don't draw a border, the LocationBarView has | 800 // When used in the app launcher, don't draw a border, the LocationBarView has |
| 801 // its own views::Border. | 801 // its own views::Border. |
| 802 | 802 |
| 803 // Draw the background color so that the graphical elements at the edges | 803 // Draw the background color so that the graphical elements at the edges |
| 804 // appear over the correct color. (The edit draws its own background, so this | 804 // appear over the correct color. (The edit draws its own background, so this |
| 805 // isn't important for that.) | 805 // isn't important for that.) |
| 806 // TODO(pkasting): We need images that are transparent in the middle, so we | 806 // TODO(pkasting): We need images that are transparent in the middle, so we |
| 807 // can draw the border images over the background color instead of the | 807 // can draw the border images over the background color instead of the |
| 808 // reverse; this antialiases better (see comments in | 808 // reverse; this antialiases better (see comments in |
| 809 // AutocompletePopupContentsView::OnPaint()). | 809 // OmniboxPopupContentsView::OnPaint()). |
| 810 gfx::Rect bounds(GetContentsBounds()); | 810 gfx::Rect bounds(GetContentsBounds()); |
| 811 bounds.Inset(0, kVerticalEdgeThickness); | 811 bounds.Inset(0, kVerticalEdgeThickness); |
| 812 SkColor color(GetColor(ToolbarModel::NONE, BACKGROUND)); | 812 SkColor color(GetColor(ToolbarModel::NONE, BACKGROUND)); |
| 813 if (mode_ == NORMAL) { | 813 if (mode_ == NORMAL) { |
| 814 SkPaint paint; | 814 SkPaint paint; |
| 815 paint.setColor(color); | 815 paint.setColor(color); |
| 816 paint.setStyle(SkPaint::kFill_Style); | 816 paint.setStyle(SkPaint::kFill_Style); |
| 817 paint.setAntiAlias(true); | 817 paint.setAntiAlias(true); |
| 818 // TODO(jamescook): Make the corners of the dropdown match the corners of | 818 // TODO(jamescook): Make the corners of the dropdown match the corners of |
| 819 // the omnibox. | 819 // the omnibox. |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1367 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 1368 int total_height = | 1368 int total_height = |
| 1369 use_preferred_size ? GetPreferredSize().height() : height(); | 1369 use_preferred_size ? GetPreferredSize().height() : height(); |
| 1370 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); | 1370 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 bool LocationBarView::HasValidSuggestText() const { | 1373 bool LocationBarView::HasValidSuggestText() const { |
| 1374 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1374 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1375 !suggested_text_view_->text().empty(); | 1375 !suggested_text_view_->text().empty(); |
| 1376 } | 1376 } |
| OLD | NEW |