Chromium Code Reviews| 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/manifest_url_info.h" | 5 #include "chrome/common/extensions/manifest_url_info.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 8 | 8 |
| 9 namespace keys = extension_manifest_keys; | 9 namespace keys = extension_manifest_keys; |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 const GURL& ManifestURLInfo::GetDevToolsPage(const Extension* extension) { | 14 const GURL& ManifestURLInfo::GetDevToolsPage(const Extension* extension) { |
| 15 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( | 15 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( |
| 16 extension->GetManifestData(keys::kDevToolsPage)); | 16 extension->GetManifestData(keys::kDevToolsPage)); |
| 17 | 17 return info ? info->url_ : GURL::EmptyGURL(); |
| 18 if (info) | |
| 19 return info->url_; | |
| 20 return GURL::EmptyGURL(); | |
| 21 } | 18 } |
| 22 | 19 |
| 23 // static | 20 // static |
| 24 const GURL ManifestURLInfo::GetHomepageURL(const Extension* extension) { | 21 const GURL ManifestURLInfo::GetHomepageURL(const Extension* extension) { |
| 25 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( | 22 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( |
| 26 extension->GetManifestData(keys::kHomepageURL)); | 23 extension->GetManifestData(keys::kHomepageURL)); |
| 27 | 24 |
| 28 if (info && info->url_.is_valid()) | 25 if (info && info->url_.is_valid()) |
| 29 return info->url_; | 26 return info->url_; |
| 30 return extension->UpdatesFromGallery() ? | 27 return extension->UpdatesFromGallery() ? |
| 31 GURL(extension_urls::GetWebstoreItemDetailURLPrefix() + extension->id()) : | 28 GURL(extension_urls::GetWebstoreItemDetailURLPrefix() + extension->id()) : |
| 32 GURL::EmptyGURL(); | 29 GURL::EmptyGURL(); |
| 33 } | 30 } |
| 34 | 31 |
| 32 // static | |
| 33 const GURL& ManifestURLInfo::GetUpdateURL(const Extension* extension) { | |
|
Yoyo Zhou
2013/01/03 23:16:00
Since these 2 are very similar to GetDevToolsPage,
Joe Thomas
2013/01/04 01:36:27
Done.
| |
| 34 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( | |
| 35 extension->GetManifestData(keys::kUpdateURL)); | |
| 36 return info ? info->url_ : GURL::EmptyGURL(); | |
| 37 } | |
| 38 | |
| 39 // static | |
| 40 const GURL& ManifestURLInfo::GetOptionsPage(const Extension* extension) { | |
| 41 ManifestURLInfo* info = static_cast<ManifestURLInfo*>( | |
| 42 extension->GetManifestData(keys::kOptionsPage)); | |
| 43 return info ? info->url_ : GURL::EmptyGURL(); | |
| 44 } | |
| 45 | |
| 35 } // namespace extensions | 46 } // namespace extensions |
| OLD | NEW |