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

Unified Diff: chrome/common/extensions/api/devtools/devtools_page_handler.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 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/devtools/devtools_page_handler.cc
diff --git a/chrome/common/extensions/api/devtools/devtools_page_handler.cc b/chrome/common/extensions/api/devtools/devtools_page_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf960141262707d5abaf787811772b68c5b80f3f
--- /dev/null
+++ b/chrome/common/extensions/api/devtools/devtools_page_handler.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/api/devtools/devtools_page_handler.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "extensions/common/error_utils.h"
+
+namespace keys = extension_manifest_keys;
+namespace errors = extension_manifest_errors;
+
+namespace extensions {
+
+namespace {
+
+} // namespace
+
+// static
+const GURL DevtoolsPageInfo::devtools_url(const Extension* extension) {
+ DevtoolsPageInfo* info = static_cast<DevtoolsPageInfo*>(
+ extension->GetManifestData(keys::kDevToolsPage));
+ if (info)
+ return info->devtools_url_;
+ return GURL();
+}
+
+
+DevtoolsPageHandler::DevtoolsPageHandler() {
+}
+
+DevtoolsPageHandler::~DevtoolsPageHandler() {
+}
+
+bool DevtoolsPageHandler::Parse(const base::Value* value,
+ Extension* extension,
pfeldman 2012/12/22 10:01:16 poor indent
+ string16* error) {
+ scoped_ptr<DevtoolsPageInfo> info(new DevtoolsPageInfo);
+ std::string devtools_str;
+ if (!value->GetAsString(&devtools_str)) {
+ *error = ASCIIToUTF16(errors::kInvalidDevToolsPage);
+ return false;
+ }
+ info->devtools_url_ = extension->GetResourceURL(devtools_str);
+ extension->SetManifestData(keys::kDevToolsPage, info.release());
+ return true;
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698