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

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

Issue 342003005: Show alert failure for reloading unpacked extensions with bad manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed be_noisy, support interaction with multiple failures Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_util.h" 5 #include "chrome/browser/extensions/extension_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return; 106 return;
107 107
108 extension_prefs->SetIsIncognitoEnabled(extension_id, enabled); 108 extension_prefs->SetIsIncognitoEnabled(extension_id, enabled);
109 109
110 bool extension_is_enabled = service->extensions()->Contains(extension_id); 110 bool extension_is_enabled = service->extensions()->Contains(extension_id);
111 111
112 // When we reload the extension the ID may be invalidated if we've passed it 112 // When we reload the extension the ID may be invalidated if we've passed it
113 // by const ref everywhere. Make a copy to be safe. 113 // by const ref everywhere. Make a copy to be safe.
114 std::string id = extension_id; 114 std::string id = extension_id;
115 if (extension_is_enabled) 115 if (extension_is_enabled)
116 service->ReloadExtension(id); 116 service->ReloadExtension(id, true);
117 117
118 // Reloading the extension invalidates the |extension| pointer. 118 // Reloading the extension invalidates the |extension| pointer.
119 extension = service->GetInstalledExtension(id); 119 extension = service->GetInstalledExtension(id);
120 if (extension) { 120 if (extension) {
121 ExtensionSyncService::Get(service->profile())-> 121 ExtensionSyncService::Get(service->profile())->
122 SyncExtensionChangeIfNeeded(*extension); 122 SyncExtensionChangeIfNeeded(*extension);
123 } 123 }
124 } 124 }
125 125
126 bool CanCrossIncognito(const Extension* extension, 126 bool CanCrossIncognito(const Extension* extension,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // Reload to update browser state. Only bother if the value changed and the 161 // Reload to update browser state. Only bother if the value changed and the
162 // extension is actually enabled, since there is no UI otherwise. 162 // extension is actually enabled, since there is no UI otherwise.
163 if (allow == AllowFileAccess(extension_id, context)) 163 if (allow == AllowFileAccess(extension_id, context))
164 return; 164 return;
165 165
166 ExtensionPrefs::Get(context)->SetAllowFileAccess(extension_id, allow); 166 ExtensionPrefs::Get(context)->SetAllowFileAccess(extension_id, allow);
167 167
168 bool extension_is_enabled = service->extensions()->Contains(extension_id); 168 bool extension_is_enabled = service->extensions()->Contains(extension_id);
169 if (extension_is_enabled) 169 if (extension_is_enabled)
170 service->ReloadExtension(extension_id); 170 service->ReloadExtension(extension_id, true);
171 } 171 }
172 172
173 bool AllowedScriptingOnAllUrls(const std::string& extension_id, 173 bool AllowedScriptingOnAllUrls(const std::string& extension_id,
174 content::BrowserContext* context) { 174 content::BrowserContext* context) {
175 bool allowed = false; 175 bool allowed = false;
176 return ExtensionPrefs::Get(context)->ReadPrefAsBoolean( 176 return ExtensionPrefs::Get(context)->ReadPrefAsBoolean(
177 extension_id, 177 extension_id,
178 kExtensionAllowedOnAllUrlsPrefName, 178 kExtensionAllowedOnAllUrlsPrefName,
179 &allowed) && 179 &allowed) &&
180 allowed; 180 allowed;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 IDR_APP_DEFAULT_ICON); 289 IDR_APP_DEFAULT_ICON);
290 } 290 }
291 291
292 const gfx::ImageSkia& GetDefaultExtensionIcon() { 292 const gfx::ImageSkia& GetDefaultExtensionIcon() {
293 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 293 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
294 IDR_EXTENSION_DEFAULT_ICON); 294 IDR_EXTENSION_DEFAULT_ICON);
295 } 295 }
296 296
297 } // namespace util 297 } // namespace util
298 } // namespace extensions 298 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698