Chromium Code Reviews| 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 #include "components/zoom/zoom_controller.h" | 68 #include "components/zoom/zoom_controller.h" |
| 69 #include "components/zoom/zoom_event_manager.h" | 69 #include "components/zoom/zoom_event_manager.h" |
| 70 #include "content/public/browser/render_widget_host_view.h" | 70 #include "content/public/browser/render_widget_host_view.h" |
| 71 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
| 72 #include "content/public/common/url_constants.h" | 72 #include "content/public/common/url_constants.h" |
| 73 #include "extensions/browser/extension_registry.h" | 73 #include "extensions/browser/extension_registry.h" |
| 74 #include "extensions/common/feature_switch.h" | 74 #include "extensions/common/feature_switch.h" |
| 75 #include "ui/accessibility/ax_node_data.h" | 75 #include "ui/accessibility/ax_node_data.h" |
| 76 #include "ui/base/dragdrop/drag_drop_types.h" | 76 #include "ui/base/dragdrop/drag_drop_types.h" |
| 77 #include "ui/base/l10n/l10n_util.h" | 77 #include "ui/base/l10n/l10n_util.h" |
| 78 #include "ui/base/material_design/material_design_controller.h" | |
| 78 #include "ui/base/resource/resource_bundle.h" | 79 #include "ui/base/resource/resource_bundle.h" |
| 79 #include "ui/base/theme_provider.h" | 80 #include "ui/base/theme_provider.h" |
| 80 #include "ui/compositor/paint_recorder.h" | 81 #include "ui/compositor/paint_recorder.h" |
| 81 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
| 82 #include "ui/gfx/animation/slide_animation.h" | 83 #include "ui/gfx/animation/slide_animation.h" |
| 83 #include "ui/gfx/canvas.h" | 84 #include "ui/gfx/canvas.h" |
| 84 #include "ui/gfx/color_palette.h" | 85 #include "ui/gfx/color_palette.h" |
| 85 #include "ui/gfx/color_utils.h" | 86 #include "ui/gfx/color_utils.h" |
| 86 #include "ui/gfx/image/image.h" | 87 #include "ui/gfx/image/image.h" |
| 87 #include "ui/gfx/image/image_skia_operations.h" | 88 #include "ui/gfx/image/image_skia_operations.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 357 |
| 357 void LocationBarView::SetShowFocusRect(bool show) { | 358 void LocationBarView::SetShowFocusRect(bool show) { |
| 358 show_focus_rect_ = show; | 359 show_focus_rect_ = show; |
| 359 SchedulePaint(); | 360 SchedulePaint(); |
| 360 } | 361 } |
| 361 | 362 |
| 362 void LocationBarView::SelectAll() { | 363 void LocationBarView::SelectAll() { |
| 363 omnibox_view_->SelectAll(true); | 364 omnibox_view_->SelectAll(true); |
| 364 } | 365 } |
| 365 | 366 |
| 366 gfx::Point LocationBarView::GetLocationBarAnchorPoint() const { | 367 gfx::Point LocationBarView::GetInfoBarAnchorPoint() const { |
| 367 const views::ImageView* image = location_icon_view_->GetImageView(); | 368 const views::ImageView* image = location_icon_view_->GetImageView(); |
| 368 const gfx::Rect image_bounds(image->GetImageBounds()); | 369 const gfx::Rect image_bounds(image->GetImageBounds()); |
| 369 gfx::Point point(image_bounds.CenterPoint().x(), image_bounds.bottom()); | 370 gfx::Point point(image_bounds.CenterPoint().x(), image_bounds.bottom()); |
| 370 ConvertPointToTarget(image, this, &point); | 371 ConvertPointToTarget(image, this, &point); |
| 371 return point; | 372 return point; |
| 372 } | 373 } |
| 373 | 374 |
| 375 views::View* LocationBarView::GetSecurityBubbleAnchorView() { | |
| 376 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) | |
|
Peter Kasting
2017/02/13 21:36:31
Nit: Should we be using LayoutDelegate::Get()->IsH
tapted
2017/02/14 04:00:27
hrm. I could go either way really, but I'm leaning
| |
| 377 return this; | |
| 378 return location_icon_view()->GetImageView(); | |
|
Peter Kasting
2017/02/13 21:36:31
Nit: Fractionally simpler:
return ui::MaterialD
tapted
2017/02/14 04:00:27
Done.
tapted
2017/02/14 04:27:08
Un-Done :) - compiler wouldn't let me do this -- t
Peter Kasting
2017/02/14 04:30:00
I probably would have "static_cast<views::View*>(t
| |
| 379 } | |
| 380 | |
| 374 void LocationBarView::GetOmniboxPopupPositioningInfo( | 381 void LocationBarView::GetOmniboxPopupPositioningInfo( |
| 375 gfx::Point* top_left_screen_coord, | 382 gfx::Point* top_left_screen_coord, |
| 376 int* popup_width, | 383 int* popup_width, |
| 377 int* left_margin, | 384 int* left_margin, |
| 378 int* right_margin, | 385 int* right_margin, |
| 379 int top_edge_overlap) { | 386 int top_edge_overlap) { |
| 380 *top_left_screen_coord = gfx::Point(0, parent()->height() - top_edge_overlap); | 387 *top_left_screen_coord = gfx::Point(0, parent()->height() - top_edge_overlap); |
| 381 views::View::ConvertPointToScreen(parent(), top_left_screen_coord); | 388 views::View::ConvertPointToScreen(parent(), top_left_screen_coord); |
| 382 | 389 |
| 383 *popup_width = parent()->width(); | 390 *popup_width = parent()->width(); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1188 // LocationBarView, private TemplateURLServiceObserver implementation: | 1195 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1189 | 1196 |
| 1190 void LocationBarView::OnTemplateURLServiceChanged() { | 1197 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1191 template_url_service_->RemoveObserver(this); | 1198 template_url_service_->RemoveObserver(this); |
| 1192 template_url_service_ = nullptr; | 1199 template_url_service_ = nullptr; |
| 1193 // If the browser is no longer active, let's not show the info bubble, as this | 1200 // If the browser is no longer active, let's not show the info bubble, as this |
| 1194 // would make the browser the active window again. | 1201 // would make the browser the active window again. |
| 1195 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1202 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1196 ShowFirstRunBubble(); | 1203 ShowFirstRunBubble(); |
| 1197 } | 1204 } |
| OLD | NEW |