Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/common/extensions/api/url_parser/url_info.cc

Issue 11624036: Move the parsing of homepage_url" and "devtools_page" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/api/url_parser/url_info.h"
6
7 #include "chrome/common/extensions/extension_manifest_constants.h"
8
9 namespace keys = extension_manifest_keys;
10
11 namespace extensions {
12
13 // static
14 const GURL URLInfo::url(const Extension* extension, const URLType url_type) {
15 URLInfo* info = NULL;
16 switch (url_type) {
17 case DEVTOOLS_PAGE:
18 info = static_cast<URLInfo*>(
19 extension->GetManifestData(keys::kDevToolsPage));
20 if (info)
21 return info->url_;
22 return GURL();
Yoyo Zhou 2012/12/27 17:16:17 You can use GURL::EmptyGURL for the missing value
Joe Thomas 2012/12/30 04:26:00 Done.
23
24 case HOMEPAGE_URL:
25 // Returns the Homepage URL for this extension. If homepage_url was not
26 // specified in the manifest, this returns the Google Gallery URL. For
27 // third-party extensions, this returns a blank GURL.
28 info = static_cast<URLInfo*>(
29 extension->GetManifestData(keys::kHomepageURL));
30 if (info && info->url_.is_valid())
31 return info->url_;
32 return extension->UpdatesFromGallery() ?
33 GURL(extension_urls::GetWebstoreItemDetailURLPrefix() +
34 extension->id()) : GURL();
35
36 default:
37 NOTREACHED() << "URL type need to be handled";
38 }
39 return GURL();
40 }
41
42 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698