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

Side by Side Diff: chrome/browser/extensions/extension_chrome_auth_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: origins 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_chrome_auth_private_api.h" 5 #include "chrome/browser/extensions/extension_chrome_auth_private_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 10 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
11 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" 11 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 13
14 namespace { 14 namespace {
15 15
16 bool IsCloudPrintEnableURL(Profile* profile, const GURL& url) { 16 bool IsCloudPrintEnableURL(Profile* profile, const GURL& url) {
17 ExtensionService* service = profile->GetExtensionService(); 17 ExtensionService* service = profile->GetExtensionService();
18 const Extension* cloud_print_app = service->GetExtensionById( 18 const Extension* cloud_print_app = service->GetExtensionById(
19 extension_misc::kCloudPrintAppId, false); 19 extension_misc::kCloudPrintAppId, false);
20 if (!cloud_print_app) { 20 if (!cloud_print_app) {
21 #if !defined(OS_CHROMEOS) 21 #if !defined(OS_CHROMEOS)
22 NOTREACHED(); 22 NOTREACHED();
23 #endif // !defined(OS_CHROMEOS) 23 #endif // !defined(OS_CHROMEOS)
24 return false; 24 return false;
25 } 25 }
26 return (service->GetExtensionByWebExtent(url) == cloud_print_app); 26 return (service->extensions()->GetByWebExtent(ExtensionURLInfo(url)) ==
27 cloud_print_app);
27 } 28 }
28 29
29 bool test_mode = false; 30 bool test_mode = false;
30 31
31 const char kAccessDeniedError[] = 32 const char kAccessDeniedError[] =
32 "Cannot call this API from a non-cloudprint URL."; 33 "Cannot call this API from a non-cloudprint URL.";
33 } // namespace 34 } // namespace
34 35
35 SetCloudPrintCredentialsFunction::SetCloudPrintCredentialsFunction() { 36 SetCloudPrintCredentialsFunction::SetCloudPrintCredentialsFunction() {
36 } 37 }
(...skipping 24 matching lines...) Expand all
61 EnableForUserWithRobot(credentials, robot_email, user_email); 62 EnableForUserWithRobot(credentials, robot_email, user_email);
62 } 63 }
63 SendResponse(true); 64 SendResponse(true);
64 return true; 65 return true;
65 } 66 }
66 67
67 // static 68 // static
68 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) { 69 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) {
69 test_mode = test_mode_enabled; 70 test_mode = test_mode_enabled;
70 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698