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

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

Issue 7677032: ntp4: make app-install-via-drag less janky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more test fixes Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { 183 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() {
184 } 184 }
185 185
186 void SimpleExtensionLoadPrompt::ShowPrompt() { 186 void SimpleExtensionLoadPrompt::ShowPrompt() {
187 install_ui_->ConfirmInstall(this, extension_); 187 install_ui_->ConfirmInstall(this, extension_);
188 } 188 }
189 189
190 void SimpleExtensionLoadPrompt::InstallUIProceed() { 190 void SimpleExtensionLoadPrompt::InstallUIProceed() {
191 if (extension_service_.get()) 191 if (extension_service_.get())
192 extension_service_->OnExtensionInstalled( 192 extension_service_->OnExtensionInstalled(
193 extension_, false); // Not from web store. 193 extension_, false, 0); // Not from web store.
Aaron Boodman 2011/09/09 21:00:16 Since there are now two magic params that need exp
194 delete this; 194 delete this;
195 } 195 }
196 196
197 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) { 197 void SimpleExtensionLoadPrompt::InstallUIAbort(bool user_initiated) {
198 delete this; 198 delete this;
199 } 199 }
200 200
201 } // namespace 201 } // namespace
202 202
203 bool ExtensionService::ComponentExtensionInfo::Equals( 203 bool ExtensionService::ComponentExtensionInfo::Equals(
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 // first. 2154 // first.
2155 if (show_extensions_prompts_ && prompt_for_plugins && 2155 if (show_extensions_prompts_ && prompt_for_plugins &&
2156 !extension->plugins().empty() && 2156 !extension->plugins().empty() &&
2157 disabled_extension_paths_.find(extension->id()) == 2157 disabled_extension_paths_.find(extension->id()) ==
2158 disabled_extension_paths_.end()) { 2158 disabled_extension_paths_.end()) {
2159 SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt( 2159 SimpleExtensionLoadPrompt* prompt = new SimpleExtensionLoadPrompt(
2160 profile_, weak_ptr_factory_.GetWeakPtr(), extension); 2160 profile_, weak_ptr_factory_.GetWeakPtr(), extension);
2161 prompt->ShowPrompt(); 2161 prompt->ShowPrompt();
2162 return; // continues in SimpleExtensionLoadPrompt::InstallUI* 2162 return; // continues in SimpleExtensionLoadPrompt::InstallUI*
2163 } 2163 }
2164 OnExtensionInstalled(extension, false); // Not from web store. 2164 OnExtensionInstalled(extension, false, 0); // Not from web store.
2165 } 2165 }
2166 2166
2167 void ExtensionService::OnExtensionInstalled( 2167 void ExtensionService::OnExtensionInstalled(
2168 const Extension* extension, bool from_webstore) { 2168 const Extension* extension, bool from_webstore, int page_index) {
2169 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2169 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2170 2170
2171 // Ensure extension is deleted unless we transfer ownership. 2171 // Ensure extension is deleted unless we transfer ownership.
2172 scoped_refptr<const Extension> scoped_extension(extension); 2172 scoped_refptr<const Extension> scoped_extension(extension);
2173 const std::string& id = extension->id(); 2173 const std::string& id = extension->id();
2174 // Extensions installed by policy can't be disabled. So even if a previous 2174 // Extensions installed by policy can't be disabled. So even if a previous
2175 // installation disabled the extension, make sure it is now enabled. 2175 // installation disabled the extension, make sure it is now enabled.
2176 bool initial_enable = 2176 bool initial_enable =
2177 !extension_prefs_->IsExtensionDisabled(id) || 2177 !extension_prefs_->IsExtensionDisabled(id) ||
2178 !Extension::UserMayDisable(extension->location()); 2178 !Extension::UserMayDisable(extension->location());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", 2215 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType",
2216 extension->GetType(), 100); 2216 extension->GetType(), 100);
2217 RecordPermissionMessagesHistogram( 2217 RecordPermissionMessagesHistogram(
2218 extension, "Extensions.Permissions_Install"); 2218 extension, "Extensions.Permissions_Install");
2219 } 2219 }
2220 2220
2221 ShownSectionsHandler::OnExtensionInstalled(profile_->GetPrefs(), extension); 2221 ShownSectionsHandler::OnExtensionInstalled(profile_->GetPrefs(), extension);
2222 extension_prefs_->OnExtensionInstalled( 2222 extension_prefs_->OnExtensionInstalled(
2223 extension, 2223 extension,
2224 initial_enable ? Extension::ENABLED : Extension::DISABLED, 2224 initial_enable ? Extension::ENABLED : Extension::DISABLED,
2225 from_webstore); 2225 from_webstore,
2226 page_index);
2226 2227
2227 // Unpacked extensions default to allowing file access, but if that has been 2228 // Unpacked extensions default to allowing file access, but if that has been
2228 // overridden, don't reset the value. 2229 // overridden, don't reset the value.
2229 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && 2230 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) &&
2230 !extension_prefs_->HasAllowFileAccessSetting(id)) { 2231 !extension_prefs_->HasAllowFileAccessSetting(id)) {
2231 extension_prefs_->SetAllowFileAccess(id, true); 2232 extension_prefs_->SetAllowFileAccess(id, true);
2232 } 2233 }
2233 2234
2234 NotificationService::current()->Notify( 2235 NotificationService::current()->Notify(
2235 chrome::NOTIFICATION_EXTENSION_INSTALLED, 2236 chrome::NOTIFICATION_EXTENSION_INSTALLED,
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 2610
2610 ExtensionService::NaClModuleInfoList::iterator 2611 ExtensionService::NaClModuleInfoList::iterator
2611 ExtensionService::FindNaClModule(const GURL& url) { 2612 ExtensionService::FindNaClModule(const GURL& url) {
2612 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2613 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2613 iter != nacl_module_list_.end(); ++iter) { 2614 iter != nacl_module_list_.end(); ++iter) {
2614 if (iter->url == url) 2615 if (iter->url == url)
2615 return iter; 2616 return iter;
2616 } 2617 }
2617 return nacl_module_list_.end(); 2618 return nacl_module_list_.end();
2618 } 2619 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698