| 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/zoom_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 void ZoomBubbleView::ShowBubble(content::WebContents* web_contents, | 39 void ZoomBubbleView::ShowBubble(content::WebContents* web_contents, |
| 40 DisplayReason reason) { | 40 DisplayReason reason) { |
| 41 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 41 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 42 DCHECK(browser && browser->window() && | 42 DCHECK(browser && browser->window() && |
| 43 browser->exclusive_access_manager()->fullscreen_controller()); | 43 browser->exclusive_access_manager()->fullscreen_controller()); |
| 44 | 44 |
| 45 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 45 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 46 bool is_fullscreen = browser_view->IsFullscreen(); | 46 bool is_fullscreen = browser_view->IsFullscreen(); |
| 47 bool anchor_to_view = !is_fullscreen || | 47 bool anchor_to_view = !is_fullscreen || |
| 48 browser_view->immersive_mode_controller()->IsRevealed(); | 48 browser_view->immersive_mode_controller()->IsRevealed(); |
| 49 views::View* anchor_view = anchor_to_view ? | 49 views::WidgetObserverView* anchor_view = anchor_to_view ? |
| 50 browser_view->GetLocationBarView()->zoom_view() : NULL; | 50 browser_view->GetLocationBarView()->zoom_view() : NULL; |
| 51 | 51 |
| 52 // Find the extension that initiated the zoom change, if any. | 52 // Find the extension that initiated the zoom change, if any. |
| 53 ui_zoom::ZoomController* zoom_controller = | 53 ui_zoom::ZoomController* zoom_controller = |
| 54 ui_zoom::ZoomController::FromWebContents(web_contents); | 54 ui_zoom::ZoomController::FromWebContents(web_contents); |
| 55 const ui_zoom::ZoomRequestClient* client = zoom_controller->last_client(); | 55 const ui_zoom::ZoomRequestClient* client = zoom_controller->last_client(); |
| 56 | 56 |
| 57 // If the bubble is already showing in this window and the zoom change was not | 57 // If the bubble is already showing in this window and the zoom change was not |
| 58 // initiated by an extension, then the bubble can be reused and only the label | 58 // initiated by an extension, then the bubble can be reused and only the label |
| 59 // text needs to be updated. | 59 // text needs to be updated. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (zoom_bubble_) | 96 if (zoom_bubble_) |
| 97 zoom_bubble_->Close(); | 97 zoom_bubble_->Close(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // static | 100 // static |
| 101 ZoomBubbleView* ZoomBubbleView::GetZoomBubble() { | 101 ZoomBubbleView* ZoomBubbleView::GetZoomBubble() { |
| 102 return zoom_bubble_; | 102 return zoom_bubble_; |
| 103 } | 103 } |
| 104 | 104 |
| 105 ZoomBubbleView::ZoomBubbleView( | 105 ZoomBubbleView::ZoomBubbleView( |
| 106 views::View* anchor_view, | 106 views::WidgetObserverView* anchor_view, |
| 107 content::WebContents* web_contents, | 107 content::WebContents* web_contents, |
| 108 DisplayReason reason, | 108 DisplayReason reason, |
| 109 ImmersiveModeController* immersive_mode_controller) | 109 ImmersiveModeController* immersive_mode_controller) |
| 110 : LocationBarBubbleDelegateView(anchor_view, web_contents), | 110 : LocationBarBubbleDelegateView(anchor_view, web_contents), |
| 111 image_button_(NULL), | 111 image_button_(NULL), |
| 112 label_(NULL), | 112 label_(NULL), |
| 113 web_contents_(web_contents), | 113 web_contents_(web_contents), |
| 114 auto_close_(reason == AUTOMATIC), | 114 auto_close_(reason == AUTOMATIC), |
| 115 immersive_mode_controller_(immersive_mode_controller) { | 115 immersive_mode_controller_(immersive_mode_controller) { |
| 116 // Compensate for built-in vertical padding in the anchor view's image. | 116 // Compensate for built-in vertical padding in the anchor view's image. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 void ZoomBubbleView::StopTimer() { | 314 void ZoomBubbleView::StopTimer() { |
| 315 timer_.Stop(); | 315 timer_.Stop(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 ZoomBubbleView::ZoomBubbleExtensionInfo::ZoomBubbleExtensionInfo() {} | 318 ZoomBubbleView::ZoomBubbleExtensionInfo::ZoomBubbleExtensionInfo() {} |
| 319 | 319 |
| 320 ZoomBubbleView::ZoomBubbleExtensionInfo::~ZoomBubbleExtensionInfo() {} | 320 ZoomBubbleView::ZoomBubbleExtensionInfo::~ZoomBubbleExtensionInfo() {} |
| OLD | NEW |