| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_bubble_delegate_view
.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view
.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 11 #include "chrome/browser/ui/layout_constants.h" | 11 #include "chrome/browser/ui/layout_constants.h" |
| 12 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.h" |
| 13 #include "content/public/browser/render_view_host.h" | 13 #include "content/public/browser/render_view_host.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" | |
| 15 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 16 | 15 |
| 17 LocationBarBubbleDelegateView::WebContentMouseHandler::WebContentMouseHandler( | 16 LocationBarBubbleDelegateView::WebContentMouseHandler::WebContentMouseHandler( |
| 18 LocationBarBubbleDelegateView* bubble, | 17 LocationBarBubbleDelegateView* bubble, |
| 19 content::WebContents* web_contents) | 18 content::WebContents* web_contents) |
| 20 : bubble_(bubble), web_contents_(web_contents) { | 19 : bubble_(bubble), web_contents_(web_contents) { |
| 21 DCHECK(bubble_); | 20 DCHECK(bubble_); |
| 22 DCHECK(web_contents_); | 21 DCHECK(web_contents_); |
| 23 event_monitor_ = views::EventMonitor::CreateWindowMonitor( | 22 event_monitor_ = views::EventMonitor::CreateWindowMonitor( |
| 24 this, web_contents_->GetTopLevelNativeWindow()); | 23 this, web_contents_->GetTopLevelNativeWindow()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 set_anchor_view_insets(gfx::Insets( | 64 set_anchor_view_insets(gfx::Insets( |
| 66 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 65 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 67 } | 66 } |
| 68 | 67 |
| 69 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {} | 68 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {} |
| 70 | 69 |
| 71 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) { | 70 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) { |
| 72 if (reason == USER_GESTURE) { | 71 if (reason == USER_GESTURE) { |
| 73 // In the USER_GESTURE case, the icon will be in an active state so the | 72 // In the USER_GESTURE case, the icon will be in an active state so the |
| 74 // bubble doesn't need an arrow. | 73 // bubble doesn't need an arrow. |
| 75 if (ui::MaterialDesignController::IsModeMaterial()) | 74 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); |
| 76 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | |
| 77 GetWidget()->Show(); | 75 GetWidget()->Show(); |
| 78 } else { | 76 } else { |
| 79 GetWidget()->ShowInactive(); | 77 GetWidget()->ShowInactive(); |
| 80 } | 78 } |
| 81 } | 79 } |
| 82 | 80 |
| 83 int LocationBarBubbleDelegateView::GetDialogButtons() const { | 81 int LocationBarBubbleDelegateView::GetDialogButtons() const { |
| 84 return ui::DIALOG_BUTTON_NONE; | 82 return ui::DIALOG_BUTTON_NONE; |
| 85 } | 83 } |
| 86 | 84 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 if (GetAnchorView()) | 100 if (GetAnchorView()) |
| 103 return; | 101 return; |
| 104 | 102 |
| 105 const int kBubblePaddingFromScreenEdge = 20; | 103 const int kBubblePaddingFromScreenEdge = 20; |
| 106 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; | 104 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; |
| 107 const int x_pos = base::i18n::IsRTL() | 105 const int x_pos = base::i18n::IsRTL() |
| 108 ? (screen_bounds.x() + horizontal_offset) | 106 ? (screen_bounds.x() + horizontal_offset) |
| 109 : (screen_bounds.right() - horizontal_offset); | 107 : (screen_bounds.right() - horizontal_offset); |
| 110 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); | 108 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); |
| 111 } | 109 } |
| OLD | NEW |