| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extension_constants.h" | 5 #include "chrome/common/extensions/extension_constants.h" |
| 6 #include "chrome/common/extensions/extension_manifest_constants.h" | 6 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); | 36 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); |
| 37 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); | 37 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); |
| 38 | 38 |
| 39 return url; | 39 return url; |
| 40 } | 40 } |
| 41 | 41 |
| 42 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { | 42 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { |
| 43 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); | 43 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const char kGalleryUpdateHttpUrl[] = | |
| 47 "http://clients2.google.com/service/update2/crx"; | |
| 48 const char kGalleryUpdateHttpsUrl[] = | 46 const char kGalleryUpdateHttpsUrl[] = |
| 49 "https://clients2.google.com/service/update2/crx"; | 47 "https://clients2.google.com/service/update2/crx"; |
| 50 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. | 48 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. |
| 51 const char kExtensionBlocklistUrlPrefix[] = | 49 const char kExtensionBlocklistUrlPrefix[] = |
| 52 "http://www.gstatic.com/chrome/extensions/blacklist"; | 50 "http://www.gstatic.com/chrome/extensions/blacklist"; |
| 53 const char kExtensionBlocklistHttpsUrlPrefix[] = | 51 const char kExtensionBlocklistHttpsUrlPrefix[] = |
| 54 "https://www.gstatic.com/chrome/extensions/blacklist"; | 52 "https://www.gstatic.com/chrome/extensions/blacklist"; |
| 55 | 53 |
| 56 GURL GetWebstoreUpdateUrl(bool secure) { | 54 GURL GetWebstoreUpdateUrl() { |
| 57 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 55 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 58 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) | 56 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) |
| 59 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL)); | 57 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL)); |
| 60 else | 58 else |
| 61 return GURL(secure ? kGalleryUpdateHttpsUrl : kGalleryUpdateHttpUrl); | 59 return GURL(kGalleryUpdateHttpsUrl); |
| 62 } | 60 } |
| 63 | 61 |
| 64 bool IsWebstoreUpdateUrl(const GURL& update_url) { | 62 bool IsWebstoreUpdateUrl(const GURL& update_url) { |
| 65 return update_url == GetWebstoreUpdateUrl(false) || | 63 GURL store_url = GetWebstoreUpdateUrl(); |
| 66 update_url == GetWebstoreUpdateUrl(true); | 64 if (update_url == store_url) { |
| 65 return true; |
| 66 } else { |
| 67 return (update_url.host() == store_url.host() && |
| 68 update_url.path() == store_url.path()); |
| 69 } |
| 67 } | 70 } |
| 68 | 71 |
| 69 bool IsBlacklistUpdateUrl(const GURL& url) { | 72 bool IsBlacklistUpdateUrl(const GURL& url) { |
| 70 // The extension blacklist URL is returned from the update service and | 73 // The extension blacklist URL is returned from the update service and |
| 71 // therefore not determined by Chromium. If the location of the blacklist file | 74 // therefore not determined by Chromium. If the location of the blacklist file |
| 72 // ever changes, we need to update this function. A DCHECK in the | 75 // ever changes, we need to update this function. A DCHECK in the |
| 73 // ExtensionUpdater ensures that we notice a change. This is the full URL | 76 // ExtensionUpdater ensures that we notice a change. This is the full URL |
| 74 // of a blacklist: | 77 // of a blacklist: |
| 75 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt | 78 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt |
| 76 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || | 79 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const char kAppStateInstalled[] = "installed"; | 133 const char kAppStateInstalled[] = "installed"; |
| 131 const char kAppStateDisabled[] = "disabled"; | 134 const char kAppStateDisabled[] = "disabled"; |
| 132 const char kAppStateRunning[] = "running"; | 135 const char kAppStateRunning[] = "running"; |
| 133 const char kAppStateCannotRun[] = "cannot_run"; | 136 const char kAppStateCannotRun[] = "cannot_run"; |
| 134 const char kAppStateReadyToRun[] = "ready_to_run"; | 137 const char kAppStateReadyToRun[] = "ready_to_run"; |
| 135 | 138 |
| 136 const char kAppNotificationsIncognitoError[] = | 139 const char kAppNotificationsIncognitoError[] = |
| 137 "This API is not accessible by 'split' mode " | 140 "This API is not accessible by 'split' mode " |
| 138 "extensions in incognito windows."; | 141 "extensions in incognito windows."; |
| 139 } | 142 } |
| OLD | NEW |