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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 5516004: Clean up PluginGroup and related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 params.mimeType.utf8(), 2683 params.mimeType.utf8(),
2684 &found, 2684 &found,
2685 &info, 2685 &info,
2686 &plugin_setting, 2686 &plugin_setting,
2687 &actual_mime_type)); 2687 &actual_mime_type));
2688 2688
2689 if (!found) 2689 if (!found)
2690 return NULL; 2690 return NULL;
2691 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 2691 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
2692 2692
2693 scoped_ptr<PluginGroup> group(PluginGroup::CopyOrCreatePluginGroup(info)); 2693 const PluginGroup* group =
2694 group->AddPlugin(info, 0); 2694 NPAPI::PluginList::Singleton()->GetPluginGroup(info);
2695 DCHECK(group != NULL);
2695 2696
2696 if (!info.enabled) { 2697 if (!info.enabled) {
2697 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) && 2698 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) &&
2698 group->IsVulnerable()) { 2699 group->IsVulnerable()) {
2699 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, 2700 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_,
2700 group->GetGroupName(), 2701 group->GetGroupName(),
2701 GURL(group->GetUpdateURL()))); 2702 GURL(group->GetUpdateURL())));
2702 return CreateOutdatedPluginPlaceholder(frame, params, group.get()); 2703 return CreateOutdatedPluginPlaceholder(frame, params, *group);
2703 } 2704 }
2704 return NULL; 2705 return NULL;
2705 } 2706 }
2706 2707
2707 ContentSetting host_setting = 2708 ContentSetting host_setting =
2708 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; 2709 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS];
2709 if (info.path.value() == kDefaultPluginLibraryName || 2710 if (info.path.value() == kDefaultPluginLibraryName ||
2710 plugin_setting == CONTENT_SETTING_ALLOW || 2711 plugin_setting == CONTENT_SETTING_ALLOW ||
2711 host_setting == CONTENT_SETTING_ALLOW) { 2712 host_setting == CONTENT_SETTING_ALLOW) {
2712 scoped_refptr<pepper::PluginModule> pepper_module; 2713 scoped_refptr<pepper::PluginModule> pepper_module;
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
4395 const WebPluginParams& params, 4396 const WebPluginParams& params,
4396 const FilePath& path, 4397 const FilePath& path,
4397 const std::string& mime_type) { 4398 const std::string& mime_type) {
4398 return new webkit_glue::WebPluginImpl( 4399 return new webkit_glue::WebPluginImpl(
4399 frame, params, path, mime_type, AsWeakPtr()); 4400 frame, params, path, mime_type, AsWeakPtr());
4400 } 4401 }
4401 4402
4402 WebPlugin* RenderView::CreateOutdatedPluginPlaceholder( 4403 WebPlugin* RenderView::CreateOutdatedPluginPlaceholder(
4403 WebFrame* frame, 4404 WebFrame* frame,
4404 const WebPluginParams& params, 4405 const WebPluginParams& params,
4405 PluginGroup* group) { 4406 const PluginGroup& group) {
4406 int resource_id = IDR_OUTDATED_PLUGIN_HTML; 4407 int resource_id = IDR_OUTDATED_PLUGIN_HTML;
4407 const base::StringPiece template_html( 4408 const base::StringPiece template_html(
4408 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); 4409 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
4409 4410
4410 DCHECK(!template_html.empty()) << "unable to load template. ID: " 4411 DCHECK(!template_html.empty()) << "unable to load template. ID: "
4411 << resource_id; 4412 << resource_id;
4412 4413
4413 DictionaryValue values; 4414 DictionaryValue values;
4414 values.SetString("message", 4415 values.SetString("message",
4415 l10n_util::GetStringFUTF8(IDS_PLUGIN_OUTDATED, group->GetGroupName())); 4416 l10n_util::GetStringFUTF8(IDS_PLUGIN_OUTDATED, group.GetGroupName()));
4416 values.Set("pluginGroup", group->GetDataForUI()); 4417 values.Set("pluginGroup", group.GetDataForUI());
4417 4418
4418 // "t" is the id of the templates root node. 4419 // "t" is the id of the templates root node.
4419 std::string htmlData = jstemplate_builder::GetTemplatesHtml( 4420 std::string htmlData = jstemplate_builder::GetTemplatesHtml(
4420 template_html, &values, "t"); 4421 template_html, &values, "t");
4421 4422
4422 return WebViewPlugin::Create(NULL, 4423 return WebViewPlugin::Create(NULL,
4423 webkit_preferences_, 4424 webkit_preferences_,
4424 htmlData, 4425 htmlData,
4425 GURL("chrome://outdatedplugin/")); 4426 GURL("chrome://outdatedplugin/"));
4426 } 4427 }
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
5687 external_popup_menu_.reset(); 5688 external_popup_menu_.reset();
5688 } 5689 }
5689 #endif 5690 #endif
5690 5691
5691 void RenderView::AddErrorToRootConsole(const string16& message) { 5692 void RenderView::AddErrorToRootConsole(const string16& message) {
5692 if (webview() && webview()->mainFrame()) { 5693 if (webview() && webview()->mainFrame()) {
5693 webview()->mainFrame()->addMessageToConsole( 5694 webview()->mainFrame()->addMessageToConsole(
5694 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5695 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5695 } 5696 }
5696 } 5697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698