Chromium Code Reviews| Index: chrome/common/extensions/api/url_parser/devtools_page_handler.cc |
| diff --git a/chrome/common/extensions/api/url_parser/devtools_page_handler.cc b/chrome/common/extensions/api/url_parser/devtools_page_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b9434e7dad9a29652b1addc5053145606b5b3a09 |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/url_parser/devtools_page_handler.cc |
| @@ -0,0 +1,39 @@ |
| +// 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/url_parser/devtools_page_handler.h" |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/utf_string_conversions.h" |
|
Yoyo Zhou
2012/12/27 17:16:17
Make sure you only include what you use.
Joe Thomas
2012/12/30 04:26:00
ASCIIToUTF16 which is used in DevToolsPageHandler:
Yoyo Zhou
2013/01/03 01:45:54
Ah, sorry. Thanks for paying more attention than m
|
| +#include "base/values.h" |
| +#include "chrome/common/extensions/api/url_parser/url_info.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 { |
| + |
| +DevToolsPageHandler::DevToolsPageHandler() { |
| +} |
| + |
| +DevToolsPageHandler::~DevToolsPageHandler() { |
| +} |
| + |
| +bool DevToolsPageHandler::Parse(const base::Value* value, |
| + Extension* extension, |
| + string16* error) { |
| + scoped_ptr<URLInfo> info(new URLInfo); |
| + std::string devtools_str; |
| + if (!value->GetAsString(&devtools_str)) { |
| + *error = ASCIIToUTF16(errors::kInvalidDevToolsPage); |
| + return false; |
| + } |
| + info->url_ = extension->GetResourceURL(devtools_str); |
| + extension->SetManifestData(keys::kDevToolsPage, info.release()); |
| + return true; |
| +} |
| + |
| +} // namespace extensions |