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

Unified Diff: chrome/browser/extensions/active_script_controller.cc

Issue 415813003: Improve extension icon prediction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final minor changes Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_action_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/active_script_controller.cc
diff --git a/chrome/browser/extensions/active_script_controller.cc b/chrome/browser/extensions/active_script_controller.cc
index 1b35b2872c9415706f9bd7585315856576cdc57b..bddc0c5707ad149e96b6d5217aaef9cff329e451 100644
--- a/chrome/browser/extensions/active_script_controller.cc
+++ b/chrome/browser/extensions/active_script_controller.cc
@@ -11,9 +11,11 @@
#include "base/stl_util.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
#include "chrome/browser/extensions/extension_action.h"
+#include "chrome/browser/extensions/extension_action_manager.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/location_bar_controller.h"
#include "chrome/browser/extensions/tab_helper.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "content/public/browser/navigation_controller.h"
@@ -110,20 +112,11 @@ ExtensionAction* ActiveScriptController::GetActionForExtension(
if (existing != active_script_actions_.end())
return existing->second.get();
- linked_ptr<ExtensionAction> action(new ExtensionAction(
- extension->id(), ActionInfo::TYPE_PAGE, ActionInfo()));
- action->SetTitle(ExtensionAction::kDefaultTabId, extension->name());
+ linked_ptr<ExtensionAction> action(ExtensionActionManager::Get(
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext()))
+ ->GetBestFitAction(*extension, ActionInfo::TYPE_PAGE).release());
action->SetIsVisible(ExtensionAction::kDefaultTabId, true);
- const ActionInfo* action_info = ActionInfo::GetPageActionInfo(extension);
- if (!action_info)
- action_info = ActionInfo::GetBrowserActionInfo(extension);
-
- if (action_info && !action_info->default_icon.empty()) {
- action->set_default_icon(
- make_scoped_ptr(new ExtensionIconSet(action_info->default_icon)));
- }
-
active_script_actions_[extension->id()] = action;
return action.get();
}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_action_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698