OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/link_disambiguation/link_disambiguation_popup.
h" | 5 #include "chrome/browser/ui/views/link_disambiguation/link_disambiguation_popup.
h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/display/display.h" |
| 10 #include "ui/display/screen.h" |
9 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
10 #include "ui/events/event_processor.h" | 12 #include "ui/events/event_processor.h" |
11 #include "ui/events/event_utils.h" | 13 #include "ui/events/event_utils.h" |
12 #include "ui/events/gesture_event_details.h" | 14 #include "ui/events/gesture_event_details.h" |
13 #include "ui/gfx/display.h" | |
14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/gfx/screen.h" | |
17 #include "ui/views/bubble/bubble_dialog_delegate.h" | 17 #include "ui/views/bubble/bubble_dialog_delegate.h" |
18 #include "ui/views/controls/image_view.h" | 18 #include "ui/views/controls/image_view.h" |
19 | 19 |
20 class LinkDisambiguationPopup::ZoomBubbleView | 20 class LinkDisambiguationPopup::ZoomBubbleView |
21 : public views::BubbleDialogDelegateView { | 21 : public views::BubbleDialogDelegateView { |
22 public: | 22 public: |
23 ZoomBubbleView(views::Widget* top_level_widget, | 23 ZoomBubbleView(views::Widget* top_level_widget, |
24 const gfx::Rect& target_rect, | 24 const gfx::Rect& target_rect, |
25 const gfx::ImageSkia* zoomed_skia_image, | 25 const gfx::ImageSkia* zoomed_skia_image, |
26 LinkDisambiguationPopup* popup, | 26 LinkDisambiguationPopup* popup, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 aura::client::GetScreenPositionClient(content_->GetRootWindow()); | 175 aura::client::GetScreenPositionClient(content_->GetRootWindow()); |
176 gfx::Point target_screen(target_rect.x() + (target_rect.width() / 2), | 176 gfx::Point target_screen(target_rect.x() + (target_rect.width() / 2), |
177 target_rect.y() + (target_rect.height() / 2)); | 177 target_rect.y() + (target_rect.height() / 2)); |
178 if (screen_position_client) | 178 if (screen_position_client) |
179 screen_position_client->ConvertPointToScreen(content_, &target_screen); | 179 screen_position_client->ConvertPointToScreen(content_, &target_screen); |
180 gfx::Rect window_bounds( | 180 gfx::Rect window_bounds( |
181 target_screen.x() - (zoomed_bitmap.width() / 2), | 181 target_screen.x() - (zoomed_bitmap.width() / 2), |
182 target_screen.y() - (zoomed_bitmap.height() / 2), | 182 target_screen.y() - (zoomed_bitmap.height() / 2), |
183 zoomed_bitmap.width(), | 183 zoomed_bitmap.width(), |
184 zoomed_bitmap.height()); | 184 zoomed_bitmap.height()); |
185 const gfx::Display display = | 185 const display::Display display = |
186 gfx::Screen::GetScreen()->GetDisplayNearestWindow(content); | 186 display::Screen::GetScreen()->GetDisplayNearestWindow(content); |
187 window_bounds.AdjustToFit(display.work_area()); | 187 window_bounds.AdjustToFit(display.work_area()); |
188 view_->GetWidget()->SetBounds(window_bounds); | 188 view_->GetWidget()->SetBounds(window_bounds); |
189 view_->GetWidget()->Show(); | 189 view_->GetWidget()->Show(); |
190 } | 190 } |
191 | 191 |
192 void LinkDisambiguationPopup::Close() { | 192 void LinkDisambiguationPopup::Close() { |
193 if (view_ && view_->GetWidget()) | 193 if (view_ && view_->GetWidget()) |
194 view_->GetWidget()->Close(); | 194 view_->GetWidget()->Close(); |
195 } | 195 } |
196 | 196 |
197 void LinkDisambiguationPopup::InvalidateBubbleView() { | 197 void LinkDisambiguationPopup::InvalidateBubbleView() { |
198 view_ = nullptr; | 198 view_ = nullptr; |
199 } | 199 } |
OLD | NEW |