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

Side by Side Diff: chrome/browser/page_state.cc

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 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
« no previous file with comments | « chrome/browser/geolocation/network_location_request.cc ('k') | chrome/browser/pref_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 } 37 }
38 } 38 }
39 39
40 void PageState::InitWithBytes(const std::string& bytes) { 40 void PageState::InitWithBytes(const std::string& bytes) {
41 // Reset our state. We create a new empty one just in case 41 // Reset our state. We create a new empty one just in case
42 // deserialization fails 42 // deserialization fails
43 state_.reset(new DictionaryValue); 43 state_.reset(new DictionaryValue);
44 44
45 JSONStringValueSerializer serializer(bytes); 45 JSONStringValueSerializer serializer(bytes);
46 scoped_ptr<Value> root(serializer.Deserialize(NULL)); 46 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL));
47 47
48 if (!root.get()) { 48 if (!root.get()) {
49 NOTREACHED(); 49 NOTREACHED();
50 return; 50 return;
51 } 51 }
52 52
53 if (root->GetType() == Value::TYPE_DICTIONARY) 53 if (root->GetType() == Value::TYPE_DICTIONARY)
54 state_.reset(static_cast<DictionaryValue*>(root.release())); 54 state_.reset(static_cast<DictionaryValue*>(root.release()));
55 } 55 }
56 56
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 return false; 103 return false;
104 } 104 }
105 105
106 PageState* PageState::Copy() const { 106 PageState* PageState::Copy() const {
107 PageState* copy = new PageState(); 107 PageState* copy = new PageState();
108 if (state_.get()) 108 if (state_.get())
109 copy->state_.reset(static_cast<DictionaryValue*>(state_->DeepCopy())); 109 copy->state_.reset(static_cast<DictionaryValue*>(state_->DeepCopy()));
110 return copy; 110 return copy;
111 } 111 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/network_location_request.cc ('k') | chrome/browser/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698