OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/common/extensions/background_info.h" | 5 #include "chrome/common/extensions/background_info.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
15 #include "chrome/common/extensions/extension_file_util.h" | 15 #include "chrome/common/extensions/extension_file_util.h" |
16 #include "chrome/common/extensions/extension_manifest_constants.h" | 16 #include "chrome/common/extensions/extension_manifest_constants.h" |
17 #include "chrome/common/extensions/permissions/api_permission_set.h" | 17 #include "chrome/common/extensions/permissions/api_permission_set.h" |
18 #include "chrome/common/extensions/permissions/permissions_data.h" | 18 #include "chrome/common/extensions/permissions/permissions_data.h" |
| 19 #include "extensions/common/constants.h" |
19 #include "extensions/common/error_utils.h" | 20 #include "extensions/common/error_utils.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 | 23 |
23 using base::DictionaryValue; | 24 using base::DictionaryValue; |
24 namespace keys = extension_manifest_keys; | 25 namespace keys = extension_manifest_keys; |
25 namespace values = extension_manifest_values; | 26 namespace values = extension_manifest_values; |
26 namespace errors = extension_manifest_errors; | 27 namespace errors = extension_manifest_errors; |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
(...skipping 21 matching lines...) Expand all Loading... |
50 } | 51 } |
51 | 52 |
52 BackgroundInfo::~BackgroundInfo() { | 53 BackgroundInfo::~BackgroundInfo() { |
53 } | 54 } |
54 | 55 |
55 // static | 56 // static |
56 GURL BackgroundInfo::GetBackgroundURL(const Extension* extension) { | 57 GURL BackgroundInfo::GetBackgroundURL(const Extension* extension) { |
57 const BackgroundInfo& info = GetBackgroundInfo(extension); | 58 const BackgroundInfo& info = GetBackgroundInfo(extension); |
58 if (info.background_scripts_.empty()) | 59 if (info.background_scripts_.empty()) |
59 return info.background_url_; | 60 return info.background_url_; |
60 return extension->GetResourceURL( | 61 return extension->GetResourceURL(filenames::kGeneratedBackgroundPageFilename); |
61 extension_filenames::kGeneratedBackgroundPageFilename); | |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 const std::vector<std::string>& BackgroundInfo::GetBackgroundScripts( | 65 const std::vector<std::string>& BackgroundInfo::GetBackgroundScripts( |
66 const Extension* extension) { | 66 const Extension* extension) { |
67 return GetBackgroundInfo(extension).background_scripts_; | 67 return GetBackgroundInfo(extension).background_scripts_; |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 bool BackgroundInfo::HasBackgroundPage(const Extension* extension) { | 71 bool BackgroundInfo::HasBackgroundPage(const Extension* extension) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 keys::kBackgroundPageLegacy, | 304 keys::kBackgroundPageLegacy, |
305 keys::kBackgroundPersistent, | 305 keys::kBackgroundPersistent, |
306 keys::kBackgroundScripts, | 306 keys::kBackgroundScripts, |
307 keys::kPlatformAppBackgroundPage, | 307 keys::kPlatformAppBackgroundPage, |
308 keys::kPlatformAppBackgroundScripts | 308 keys::kPlatformAppBackgroundScripts |
309 }; | 309 }; |
310 return std::vector<std::string>(keys, keys + arraysize(keys)); | 310 return std::vector<std::string>(keys, keys + arraysize(keys)); |
311 } | 311 } |
312 | 312 |
313 } // namespace extensions | 313 } // namespace extensions |
OLD | NEW |