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

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

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/common/render_messages.h" 24 #include "chrome/common/render_messages.h"
25 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "content/public/browser/plugin_service.h" 26 #include "content/public/browser/plugin_service.h"
27 #include "content/public/browser/render_view_host.h" 27 #include "content/public/browser/render_view_host.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/browser/web_contents_delegate.h" 29 #include "content/public/browser/web_contents_delegate.h"
30 #include "content/public/browser/web_contents_view.h" 30 #include "content/public/browser/web_contents_view.h"
31 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
32 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/resource/resource_bundle.h"
35 #include "webkit/plugins/webplugininfo.h" 34 #include "webkit/plugins/webplugininfo.h"
36 35
37 #if defined(ENABLE_PLUGIN_INSTALLATION) 36 #if defined(ENABLE_PLUGIN_INSTALLATION)
38 #if defined(OS_WIN) 37 #if defined(OS_WIN)
39 #include "base/win/metro.h" 38 #include "base/win/metro.h"
40 #endif 39 #endif
41 #include "chrome/browser/plugins/plugin_installer.h" 40 #include "chrome/browser/plugins/plugin_installer.h"
42 #include "chrome/browser/plugins/plugin_installer_observer.h" 41 #include "chrome/browser/plugins/plugin_installer_observer.h"
43 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" 42 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
44 #endif // defined(ENABLE_PLUGIN_INSTALLATION) 43 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 #else 217 #else
219 // Calling the POSIX version of base::GetTerminationStatus() may affect other 218 // Calling the POSIX version of base::GetTerminationStatus() may affect other
220 // code which is interested in the process termination status. (Please see the 219 // code which is interested in the process termination status. (Please see the
221 // comment of the function.) Therefore, a better way is needed to distinguish 220 // comment of the function.) Therefore, a better way is needed to distinguish
222 // disconnections from crashes. 221 // disconnections from crashes.
223 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, 222 infobar_text = l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT,
224 plugin_name); 223 plugin_name);
225 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1); 224 UMA_HISTOGRAM_COUNTS("Plugin.ShowCrashedInfobar", 1);
226 #endif 225 #endif
227 226
228 gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
229 IDR_INFOBAR_PLUGIN_CRASHED);
230 SimpleAlertInfoBarDelegate::Create( 227 SimpleAlertInfoBarDelegate::Create(
231 InfoBarService::FromWebContents(web_contents()), icon, infobar_text, 228 InfoBarService::FromWebContents(web_contents()),
232 true); 229 IDR_INFOBAR_PLUGIN_CRASHED, infobar_text, true);
233 } 230 }
234 231
235 bool PluginObserver::OnMessageReceived(const IPC::Message& message) { 232 bool PluginObserver::OnMessageReceived(const IPC::Message& message) {
236 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) 233 IPC_BEGIN_MESSAGE_MAP(PluginObserver, message)
237 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, 234 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin,
238 OnBlockedOutdatedPlugin) 235 OnBlockedOutdatedPlugin)
239 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin, 236 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin,
240 OnBlockedUnauthorizedPlugin) 237 OnBlockedUnauthorizedPlugin)
241 #if defined(ENABLE_PLUGIN_INSTALLATION) 238 #if defined(ENABLE_PLUGIN_INSTALLATION)
242 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin, 239 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 WebKit::WebReferrerPolicyDefault), 372 WebKit::WebReferrerPolicyDefault),
376 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); 373 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false));
377 } 374 }
378 375
379 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { 376 void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) {
380 g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path); 377 g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path);
381 string16 plugin_name = 378 string16 plugin_name =
382 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); 379 PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path);
383 SimpleAlertInfoBarDelegate::Create( 380 SimpleAlertInfoBarDelegate::Create(
384 InfoBarService::FromWebContents(web_contents()), 381 InfoBarService::FromWebContents(web_contents()),
385 &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 382 IDR_INFOBAR_PLUGIN_CRASHED,
386 IDR_INFOBAR_PLUGIN_CRASHED),
387 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, 383 l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT,
388 plugin_name), 384 plugin_name),
389 true /* auto_expire */); 385 true /* auto_expire */);
390 } 386 }
391 387
392 void PluginObserver::OnNPAPINotSupported(const std::string& identifier) { 388 void PluginObserver::OnNPAPINotSupported(const std::string& identifier) {
393 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) 389 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION)
394 #if !defined(USE_AURA) 390 #if !defined(USE_AURA)
395 DCHECK(base::win::IsMetroProcess()); 391 DCHECK(base::win::IsMetroProcess());
396 #endif 392 #endif
(...skipping 16 matching lines...) Expand all
413 identifier, NULL, &plugin)) { 409 identifier, NULL, &plugin)) {
414 NOTREACHED(); 410 NOTREACHED();
415 return; 411 return;
416 } 412 }
417 413
418 PluginMetroModeInfoBarDelegate::Create( 414 PluginMetroModeInfoBarDelegate::Create(
419 InfoBarService::FromWebContents(web_contents()), 415 InfoBarService::FromWebContents(web_contents()),
420 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name()); 416 PluginMetroModeInfoBarDelegate::DESKTOP_MODE_REQUIRED, plugin->name());
421 #endif 417 #endif
422 } 418 }
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_infobar_delegates.cc ('k') | chrome/browser/ssl/ssl_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698