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

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

Issue 8827013: Move/replace/rename URL-based extension getters from ExtensionService to/in ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extent 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_webstore_private_api.h" 5 #include "chrome/browser/extensions/extension_webstore_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return profile->GetProfileSyncService(); 65 return profile->GetProfileSyncService();
66 } 66 }
67 67
68 bool IsWebStoreURL(Profile* profile, const GURL& url) { 68 bool IsWebStoreURL(Profile* profile, const GURL& url) {
69 ExtensionService* service = profile->GetExtensionService(); 69 ExtensionService* service = profile->GetExtensionService();
70 const Extension* store = service->GetWebStoreApp(); 70 const Extension* store = service->GetWebStoreApp();
71 if (!store) { 71 if (!store) {
72 NOTREACHED(); 72 NOTREACHED();
73 return false; 73 return false;
74 } 74 }
75 return (service->GetExtensionByWebExtent(url) == store); 75 return (service->extensions()->GetByWebExtent(url) == store);
76 } 76 }
77 77
78 // Whitelists extension IDs for use by webstorePrivate.silentlyInstall. 78 // Whitelists extension IDs for use by webstorePrivate.silentlyInstall.
79 bool trust_test_ids = false; 79 bool trust_test_ids = false;
80 80
81 bool IsTrustedForSilentInstall(const std::string& id) { 81 bool IsTrustedForSilentInstall(const std::string& id) {
82 // Trust the extensions in api_test/webstore_private/bundle when the flag 82 // Trust the extensions in api_test/webstore_private/bundle when the flag
83 // is set. 83 // is set.
84 if (trust_test_ids && 84 if (trust_test_ids &&
85 (id == "begfmnajjkbjdgmffnjaojchoncnmngg" || 85 (id == "begfmnajjkbjdgmffnjaojchoncnmngg" ||
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 bool SetStoreLoginFunction::RunImpl() { 484 bool SetStoreLoginFunction::RunImpl() {
485 if (!IsWebStoreURL(profile_, source_url())) 485 if (!IsWebStoreURL(profile_, source_url()))
486 return false; 486 return false;
487 std::string login; 487 std::string login;
488 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); 488 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login));
489 ExtensionService* service = profile_->GetExtensionService(); 489 ExtensionService* service = profile_->GetExtensionService();
490 ExtensionPrefs* prefs = service->extension_prefs(); 490 ExtensionPrefs* prefs = service->extension_prefs();
491 prefs->SetWebStoreLogin(login); 491 prefs->SetWebStoreLogin(login);
492 return true; 492 return true;
493 } 493 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698