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/external_policy_extension_loader.h" | 5 #include "chrome/browser/extensions/external_policy_extension_loader.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Check an extension ID and an URL to be syntactically correct. | 21 // Check an extension ID and an URL to be syntactically correct. |
22 bool CheckExtension(const std::string& id, const std::string& update_url) { | 22 bool CheckExtension(const std::string& id, const std::string& update_url) { |
23 GURL url(update_url); | 23 GURL url(update_url); |
24 if (!url.is_valid()) { | 24 if (!url.is_valid()) { |
25 LOG(WARNING) << "Policy specifies invalid update URL for external " | 25 LOG(WARNING) << "Policy specifies invalid update URL for external " |
26 << "extension: " << update_url; | 26 << "extension: " << update_url; |
27 return false; | 27 return false; |
28 } | 28 } |
29 if (!Extension::IdIsValid(id)) { | 29 if (!extensions::Extension::IdIsValid(id)) { |
30 LOG(WARNING) << "Policy specifies invalid ID for external " | 30 LOG(WARNING) << "Policy specifies invalid ID for external " |
31 << "extension: " << id; | 31 << "extension: " << id; |
32 return false; | 32 return false; |
33 } | 33 } |
34 return true; | 34 return true; |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 ExternalPolicyExtensionLoader::ExternalPolicyExtensionLoader( | 39 ExternalPolicyExtensionLoader::ExternalPolicyExtensionLoader( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 notification_registrar_.RemoveAll(); | 95 notification_registrar_.RemoveAll(); |
96 pref_change_registrar_.RemoveAll(); | 96 pref_change_registrar_.RemoveAll(); |
97 profile_ = NULL; | 97 profile_ = NULL; |
98 } | 98 } |
99 break; | 99 break; |
100 } | 100 } |
101 default: | 101 default: |
102 NOTREACHED() << "Unexpected notification type."; | 102 NOTREACHED() << "Unexpected notification type."; |
103 } | 103 } |
104 } | 104 } |
OLD | NEW |