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

Unified Diff: chrome/common/web_resource/web_resource_unpacker.cc

Issue 19224002: Get rid of single process code path in json_asynchronous_unpacker.cc. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move web_resource_unpacker Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/web_resource/web_resource_unpacker.h ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/web_resource/web_resource_unpacker.cc
===================================================================
--- chrome/common/web_resource/web_resource_unpacker.cc (revision 211642)
+++ chrome/common/web_resource/web_resource_unpacker.cc (working copy)
@@ -1,45 +0,0 @@
-// Copyright (c) 2009 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/web_resource/web_resource_unpacker.h"
-
-#include "base/json/json_reader.h"
-#include "base/values.h"
-
-const char* WebResourceUnpacker::kInvalidDataTypeError =
- "Data from web resource server is missing or not valid JSON.";
-
-const char* WebResourceUnpacker::kUnexpectedJSONFormatError =
- "Data from web resource server does not have expected format.";
-
-WebResourceUnpacker::WebResourceUnpacker(const std::string &resource_data)
- : resource_data_(resource_data) {
-}
-
-WebResourceUnpacker::~WebResourceUnpacker() {
-}
-
-// TODO(mrc): Right now, this reads JSON data from the experimental popgadget
-// server. Change so the format is based on a template, once we have
-// decided on final server format.
-bool WebResourceUnpacker::Run() {
- scoped_ptr<base::Value> value;
- if (!resource_data_.empty()) {
- value.reset(base::JSONReader::Read(resource_data_));
- if (!value.get()) {
- // Page information not properly read, or corrupted.
- error_message_ = kInvalidDataTypeError;
- return false;
- }
- if (!value->IsType(base::Value::TYPE_DICTIONARY)) {
- error_message_ = kUnexpectedJSONFormatError;
- return false;
- }
- parsed_json_.reset(static_cast<base::DictionaryValue*>(value.release()));
- return true;
- }
- error_message_ = kInvalidDataTypeError;
- return false;
-}
-
« no previous file with comments | « chrome/common/web_resource/web_resource_unpacker.h ('k') | chrome/utility/chrome_content_utility_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698