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

Side by Side Diff: chrome/browser/plugin_installer.cc

Issue 6249010: Cleanup: de-inline a bunch of classes, rename and move "PluginInstaller" to "... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/plugin_installer.h ('k') | chrome/browser/plugin_installer_infobar_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/plugin_installer.h"
6
7 #include "app/l10n_util.h"
8 #include "base/string_util.h"
9 #include "chrome/browser/renderer_host/render_view_host.h"
10 #include "chrome/browser/tab_contents/tab_contents.h"
11 #include "grit/generated_resources.h"
12 #include "grit/locale_settings.h"
13 #include "grit/theme_resources.h"
14 #include "ui/base/resource/resource_bundle.h"
15 #include "webkit/plugins/npapi/default_plugin_shared.h"
16
17 // The URL for the "Problems installing" page for the Plugins infobar.
18 static const char kLearnMorePluginInstallerUrl[] =
19 "http://www.google.com/support/chrome/bin/answer.py?answer=95697&topic=1 4687";
20
21 PluginInstaller::PluginInstaller(TabContents* tab_contents)
22 : ConfirmInfoBarDelegate(tab_contents),
23 tab_contents_(tab_contents) {
24 }
25
26 PluginInstaller::~PluginInstaller() {
27 // Remove any InfoBars we may be showing.
28 tab_contents_->RemoveInfoBar(this);
29 }
30
31 void PluginInstaller::OnMissingPluginStatus(int status) {
32 switch (status) {
33 case webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE: {
34 tab_contents_->AddInfoBar(this);
35 break;
36 }
37 case webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: {
38 // Hide the InfoBar if user already started download/install of the
39 // missing plugin.
40 tab_contents_->RemoveInfoBar(this);
41 break;
42 }
43 default: {
44 NOTREACHED();
45 break;
46 }
47 }
48 }
49
50 string16 PluginInstaller::GetMessageText() const {
51 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_MISSINGPLUGIN_PROMPT);
52 }
53
54 SkBitmap* PluginInstaller::GetIcon() const {
55 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
56 IDR_INFOBAR_PLUGIN_INSTALL);
57 }
58
59 int PluginInstaller::GetButtons() const {
60 return BUTTON_OK;
61 }
62
63 string16 PluginInstaller::GetButtonLabel(InfoBarButton button) const {
64 if (button == BUTTON_OK)
65 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON);
66 return ConfirmInfoBarDelegate::GetButtonLabel(button);
67 }
68
69 bool PluginInstaller::Accept() {
70 tab_contents_->render_view_host()->InstallMissingPlugin();
71 return true;
72 }
73
74 string16 PluginInstaller::GetLinkText() {
75 return l10n_util::GetStringUTF16(IDS_PLUGININSTALLER_PROBLEMSINSTALLING);
76 }
77
78 bool PluginInstaller::LinkClicked(WindowOpenDisposition disposition) {
79 // Ignore the click dispostion and always open in a new top level tab.
80 tab_contents_->OpenURL(GURL(kLearnMorePluginInstallerUrl), GURL(),
81 NEW_FOREGROUND_TAB, PageTransition::LINK);
82 return false; // Do not dismiss the info bar.
83 }
OLDNEW
« no previous file with comments | « chrome/browser/plugin_installer.h ('k') | chrome/browser/plugin_installer_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698