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

Side by Side Diff: chrome/browser/extensions/extension_context_menu_model.cc

Issue 6721013: extensions: Refactor ExtensionInstallUI class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: indentation Created 9 years, 9 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_context_menu_model.h" 5 #include "chrome/browser/extensions/extension_context_menu_model.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_tabs_module.h" 9 #include "chrome/browser/extensions/extension_tabs_module.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/extension_action.h" 14 #include "chrome/common/extensions/extension_action.h"
14 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
15 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 19
20 enum MenuEntries { 20 enum MenuEntries {
21 NAME = 0, 21 NAME = 0,
22 CONFIGURE, 22 CONFIGURE,
23 HIDE, 23 HIDE,
24 DISABLE, 24 DISABLE,
25 UNINSTALL, 25 UNINSTALL,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 ExtensionService* extension_service = profile_->GetExtensionService(); 120 ExtensionService* extension_service = profile_->GetExtensionService();
121 extension_service->SetBrowserActionVisibility(extension, false); 121 extension_service->SetBrowserActionVisibility(extension, false);
122 break; 122 break;
123 } 123 }
124 case DISABLE: { 124 case DISABLE: {
125 ExtensionService* extension_service = profile_->GetExtensionService(); 125 ExtensionService* extension_service = profile_->GetExtensionService();
126 extension_service->DisableExtension(extension_id_); 126 extension_service->DisableExtension(extension_id_);
127 break; 127 break;
128 } 128 }
129 case UNINSTALL: { 129 case UNINSTALL: {
130 AddRef(); // Balanced in InstallUIProceed and InstallUIAbort. 130 AddRef(); // Balanced in Accepted() and Canceled()
131 install_ui_.reset(new ExtensionInstallUI(profile_)); 131 extension_uninstall_dialog_.reset(new ExtensionUninstallDialog(profile_));
132 install_ui_->ConfirmUninstall(this, extension); 132 extension_uninstall_dialog_->ConfirmUninstall(this, extension);
133 break; 133 break;
134 } 134 }
135 case MANAGE: { 135 case MANAGE: {
136 browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(), 136 browser_->OpenURL(GURL(chrome::kChromeUIExtensionsURL), GURL(),
137 SINGLETON_TAB, PageTransition::LINK); 137 SINGLETON_TAB, PageTransition::LINK);
138 break; 138 break;
139 } 139 }
140 case INSPECT_POPUP: { 140 case INSPECT_POPUP: {
141 delegate_->InspectPopup(extension_action_); 141 delegate_->InspectPopup(extension_action_);
142 break; 142 break;
143 } 143 }
144 default: 144 default:
145 NOTREACHED() << "Unknown option"; 145 NOTREACHED() << "Unknown option";
146 break; 146 break;
147 } 147 }
148 } 148 }
149 149
150 void ExtensionContextMenuModel::InstallUIProceed() { 150 void ExtensionContextMenuModel::ExtensionDialogAccepted() {
151 if (GetExtension()) 151 if (GetExtension())
152 profile_->GetExtensionService()->UninstallExtension(extension_id_, false); 152 profile_->GetExtensionService()->UninstallExtension(extension_id_, false);
153 153
154 Release(); 154 Release();
155 } 155 }
156 156
157 void ExtensionContextMenuModel::InstallUIAbort() { 157 void ExtensionContextMenuModel::ExtensionDialogCanceled() {
158 Release(); 158 Release();
159 } 159 }
160 160
161 const Extension* ExtensionContextMenuModel::GetExtension() const { 161 const Extension* ExtensionContextMenuModel::GetExtension() const {
162 ExtensionService* extension_service = profile_->GetExtensionService(); 162 ExtensionService* extension_service = profile_->GetExtensionService();
163 return extension_service->GetExtensionById(extension_id_, false); 163 return extension_service->GetExtensionById(extension_id_, false);
164 } 164 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_model.h ('k') | chrome/browser/extensions/extension_install_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698