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

Side by Side Diff: chrome/browser/plugins/plugin_observer.cc

Issue 2972123002: Click to Open PDF: Open PDF once View PDF is clicked. (Closed)
Patch Set: remove id since it's not used Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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/plugins/plugin_observer.h" 5 #include "chrome/browser/plugins/plugin_observer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, 260 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin,
261 OnBlockedOutdatedPlugin) 261 OnBlockedOutdatedPlugin)
262 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedComponentUpdatedPlugin, 262 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedComponentUpdatedPlugin,
263 OnBlockedComponentUpdatedPlugin) 263 OnBlockedComponentUpdatedPlugin)
264 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RemovePluginPlaceholderHost, 264 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RemovePluginPlaceholderHost,
265 OnRemovePluginPlaceholderHost) 265 OnRemovePluginPlaceholderHost)
266 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowFlashPermissionBubble, 266 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowFlashPermissionBubble,
267 OnShowFlashPermissionBubble) 267 OnShowFlashPermissionBubble)
268 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, 268 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin,
269 OnCouldNotLoadPlugin) 269 OnCouldNotLoadPlugin)
270 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DownloadPDF, OnDownloadPDF)
270 271
271 IPC_MESSAGE_UNHANDLED(return false) 272 IPC_MESSAGE_UNHANDLED(return false)
272 IPC_END_MESSAGE_MAP() 273 IPC_END_MESSAGE_MAP()
273 274
274 return true; 275 return true;
275 } 276 }
276 277
277 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, 278 void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id,
278 const std::string& identifier) { 279 const std::string& identifier) {
279 PluginFinder* finder = PluginFinder::GetInstance(); 280 PluginFinder* finder = PluginFinder::GetInstance();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 plugin_path); 329 plugin_path);
329 base::string16 plugin_name = 330 base::string16 plugin_name =
330 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); 331 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path);
331 SimpleAlertInfoBarDelegate::Create( 332 SimpleAlertInfoBarDelegate::Create(
332 InfoBarService::FromWebContents(web_contents()), 333 InfoBarService::FromWebContents(web_contents()),
333 infobars::InfoBarDelegate::PLUGIN_OBSERVER, &kExtensionCrashedIcon, 334 infobars::InfoBarDelegate::PLUGIN_OBSERVER, &kExtensionCrashedIcon,
334 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, 335 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT,
335 plugin_name), 336 plugin_name),
336 true); 337 true);
337 } 338 }
339
340 void PluginObserver::OnDownloadPDF(const GURL& url) {
341 web_contents()->OpenURL(content::OpenURLParams(
Lei Zhang 2017/07/07 17:45:45 Have you looked into OpenURL() vs SaveFrame() ?
amberwon 2017/07/07 20:44:22 I've looked into both. At the moment, both Tommy a
Lei Zhang 2017/07/07 21:08:20 FWIW, SaveFrame() is used exclusively by the PDF p
342 url,
343 content::Referrer::SanitizeForRequest(
344 url, content::Referrer(web_contents()->GetURL(),
345 blink::kWebReferrerPolicyDefault)),
346 WindowOpenDisposition::NEW_FOREGROUND_TAB,
347 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false));
348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698