OLD | NEW |
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/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 bool IsCloudPrintEnableURL(Profile* profile, const GURL& url) { | 15 bool IsCloudPrintEnableURL(Profile* profile, const GURL& url) { |
16 ExtensionService* service = profile->GetExtensionService(); | 16 ExtensionService* service = profile->GetExtensionService(); |
17 const Extension* cloud_print_app = service->GetExtensionById( | 17 const Extension* cloud_print_app = service->GetExtensionById( |
18 extension_misc::kCloudPrintAppId, false); | 18 extension_misc::kCloudPrintAppId, false); |
19 if (!cloud_print_app) { | 19 if (!cloud_print_app) { |
| 20 #if !defined(OS_CHROMEOS) |
20 NOTREACHED(); | 21 NOTREACHED(); |
| 22 #endif // !defined(OS_CHROMEOS) |
21 return false; | 23 return false; |
22 } | 24 } |
23 return (service->GetExtensionByWebExtent(url) == cloud_print_app); | 25 return (service->GetExtensionByWebExtent(url) == cloud_print_app); |
24 } | 26 } |
25 | 27 |
26 bool test_mode = false; | 28 bool test_mode = false; |
27 | 29 |
28 const char kAccessDeniedError[] = | 30 const char kAccessDeniedError[] = |
29 "Cannot call this API from a non-cloudprint URL."; | 31 "Cannot call this API from a non-cloudprint URL."; |
30 } // namespace | 32 } // namespace |
(...skipping 27 matching lines...) Expand all Loading... |
58 credentials, robot_email, user_email); | 60 credentials, robot_email, user_email); |
59 } | 61 } |
60 SendResponse(true); | 62 SendResponse(true); |
61 return true; | 63 return true; |
62 } | 64 } |
63 | 65 |
64 // static | 66 // static |
65 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) { | 67 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) { |
66 test_mode = test_mode_enabled; | 68 test_mode = test_mode_enabled; |
67 } | 69 } |
OLD | NEW |