Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: chrome/browser/ui/views/location_bar/zoom_bubble_view.cc

Issue 1414643005: Disable zoom bubble for PDF extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Need to check for valid client before early out. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
index 9308b6dc24fc9b7f18f8bccc2e623e6401425a37..5f4087187e3616882862bd78f925795e8fb1be34 100644
--- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
@@ -7,6 +7,7 @@
#include "base/i18n/rtl.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
@@ -38,6 +39,18 @@ ZoomBubbleView* ZoomBubbleView::zoom_bubble_ = NULL;
// static
void ZoomBubbleView::ShowBubble(content::WebContents* web_contents,
bool auto_close) {
+ // Find the extension that initiated the zoom change, if any.
+ ui_zoom::ZoomController* zoom_controller =
+ ui_zoom::ZoomController::FromWebContents(web_contents);
+ const extensions::ExtensionZoomRequestClient* client =
+ static_cast<const extensions::ExtensionZoomRequestClient*>(
+ zoom_controller->last_client());
+
+ if (auto_close && client &&
+ extensions::util::ZoomWithoutBubble(client->extension())) {
+ return;
+ }
+
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
DCHECK(browser && browser->window() &&
browser->exclusive_access_manager()->fullscreen_controller());
@@ -49,11 +62,6 @@ void ZoomBubbleView::ShowBubble(content::WebContents* web_contents,
views::View* anchor_view = anchor_to_view ?
browser_view->GetLocationBarView()->zoom_view() : NULL;
- // Find the extension that initiated the zoom change, if any.
- ui_zoom::ZoomController* zoom_controller =
- ui_zoom::ZoomController::FromWebContents(web_contents);
- const ui_zoom::ZoomRequestClient* client = zoom_controller->last_client();
-
// If the bubble is already showing in this window and the zoom change was not
// initiated by an extension, then the bubble can be reused and only the label
// text needs to be updated.
@@ -72,11 +80,8 @@ void ZoomBubbleView::ShowBubble(content::WebContents* web_contents,
// If the zoom change was initiated by an extension, capture the relevent
// information from it.
- if (client) {
- zoom_bubble_->SetExtensionInfo(
- static_cast<const extensions::ExtensionZoomRequestClient*>(client)
- ->extension());
- }
+ if (client)
+ zoom_bubble_->SetExtensionInfo(client->extension());
// If we do not have an anchor view, parent the bubble to the content area.
if (!anchor_to_view)

Powered by Google App Engine
This is Rietveld 408576698