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

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

Issue 8198003: Convert app_launch_index and page_index from int to StringOrdinal. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixing clang compile Created 9 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) 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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 iter != extensions_.end(); ++iter) { 2031 iter != extensions_.end(); ++iter) {
2032 const Extension* extension = *iter; 2032 const Extension* extension = *iter;
2033 if (!extension->is_theme() && extension->location() != Extension::COMPONENT) 2033 if (!extension->is_theme() && extension->location() != Extension::COMPONENT)
2034 extension_ids.insert(extension->id()); 2034 extension_ids.insert(extension->id());
2035 } 2035 }
2036 2036
2037 child_process_logging::SetActiveExtensions(extension_ids); 2037 child_process_logging::SetActiveExtensions(extension_ids);
2038 } 2038 }
2039 2039
2040 void ExtensionService::OnExtensionInstalled( 2040 void ExtensionService::OnExtensionInstalled(
2041 const Extension* extension, bool from_webstore, int page_index) { 2041 const Extension* extension,
2042 bool from_webstore,
2043 const StringOrdinal& page_ordinal) {
2042 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2044 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2043 2045
2044 // Ensure extension is deleted unless we transfer ownership. 2046 // Ensure extension is deleted unless we transfer ownership.
2045 scoped_refptr<const Extension> scoped_extension(extension); 2047 scoped_refptr<const Extension> scoped_extension(extension);
2046 const std::string& id = extension->id(); 2048 const std::string& id = extension->id();
2047 // Extensions installed by policy can't be disabled. So even if a previous 2049 // Extensions installed by policy can't be disabled. So even if a previous
2048 // installation disabled the extension, make sure it is now enabled. 2050 // installation disabled the extension, make sure it is now enabled.
2049 bool initial_enable = 2051 bool initial_enable =
2050 !extension_prefs_->IsExtensionDisabled(id) || 2052 !extension_prefs_->IsExtensionDisabled(id) ||
2051 !Extension::UserMayDisable(extension->location()); 2053 !Extension::UserMayDisable(extension->location());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2088 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", 2090 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType",
2089 extension->GetType(), 100); 2091 extension->GetType(), 100);
2090 RecordPermissionMessagesHistogram( 2092 RecordPermissionMessagesHistogram(
2091 extension, "Extensions.Permissions_Install"); 2093 extension, "Extensions.Permissions_Install");
2092 } 2094 }
2093 2095
2094 extension_prefs_->OnExtensionInstalled( 2096 extension_prefs_->OnExtensionInstalled(
2095 extension, 2097 extension,
2096 initial_enable ? Extension::ENABLED : Extension::DISABLED, 2098 initial_enable ? Extension::ENABLED : Extension::DISABLED,
2097 from_webstore, 2099 from_webstore,
2098 page_index); 2100 page_ordinal);
2099 2101
2100 // Unpacked extensions default to allowing file access, but if that has been 2102 // Unpacked extensions default to allowing file access, but if that has been
2101 // overridden, don't reset the value. 2103 // overridden, don't reset the value.
2102 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && 2104 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) &&
2103 !extension_prefs_->HasAllowFileAccessSetting(id)) { 2105 !extension_prefs_->HasAllowFileAccessSetting(id)) {
2104 extension_prefs_->SetAllowFileAccess(id, true); 2106 extension_prefs_->SetAllowFileAccess(id, true);
2105 } 2107 }
2106 2108
2107 // If the extension should automatically block network startup (e.g., it uses 2109 // If the extension should automatically block network startup (e.g., it uses
2108 // the webRequest API), set the preference. Otherwise clear it, in case the 2110 // the webRequest API), set the preference. Otherwise clear it, in case the
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 const ExtensionResource &resource, 2582 const ExtensionResource &resource,
2581 int index) { 2583 int index) {
2582 // If the image failed to load (e.g. if the resource being loaded was empty) 2584 // If the image failed to load (e.g. if the resource being loaded was empty)
2583 // use the standard application icon. 2585 // use the standard application icon.
2584 if (!image || image->isNull()) 2586 if (!image || image->isNull())
2585 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); 2587 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON);
2586 2588
2587 shortcut_info_.favicon = *image; 2589 shortcut_info_.favicon = *image;
2588 web_app::CreateShortcut(profile_->GetPath(), shortcut_info_); 2590 web_app::CreateShortcut(profile_->GetPath(), shortcut_info_);
2589 } 2591 }
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