OLD | NEW |
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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/page_state.h" | 8 #include "chrome/browser/page_state.h" |
9 #include "chrome/common/json_value_serializer.h" | 9 #include "chrome/common/json_value_serializer.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return false; | 75 return false; |
76 } | 76 } |
77 | 77 |
78 void PageState::SetInt64Property(const std::wstring& key, int64 value) { | 78 void PageState::SetInt64Property(const std::wstring& key, int64 value) { |
79 SetProperty(key, Int64ToWString(value)); | 79 SetProperty(key, Int64ToWString(value)); |
80 } | 80 } |
81 | 81 |
82 bool PageState::GetInt64Property(const std::wstring& key, int64* value) const { | 82 bool PageState::GetInt64Property(const std::wstring& key, int64* value) const { |
83 std::wstring v; | 83 std::wstring v; |
84 if (GetProperty(key, &v)) { | 84 if (GetProperty(key, &v)) { |
85 return StringToInt64(v, value); | 85 return StringToInt64(WideToUTF16Hack(v), value); |
86 } | 86 } |
87 return false; | 87 return false; |
88 } | 88 } |
89 | 89 |
90 void PageState::SetIntProperty(const std::wstring& key, int value) { | 90 void PageState::SetIntProperty(const std::wstring& key, int value) { |
91 SetProperty(key, IntToWString(value)); | 91 SetProperty(key, IntToWString(value)); |
92 } | 92 } |
93 | 93 |
94 bool PageState::GetIntProperty(const std::wstring& key, int* value) const { | 94 bool PageState::GetIntProperty(const std::wstring& key, int* value) const { |
95 std::wstring v; | 95 std::wstring v; |
96 if (GetProperty(key, &v)) { | 96 if (GetProperty(key, &v)) { |
97 return StringToInt(v, value); | 97 return StringToInt(WideToUTF16Hack(v), value); |
98 } | 98 } |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 PageState* PageState::Copy() const { | 102 PageState* PageState::Copy() const { |
103 PageState* copy = new PageState(); | 103 PageState* copy = new PageState(); |
104 if (state_.get()) | 104 if (state_.get()) |
105 copy->state_.reset(static_cast<DictionaryValue*>(state_->DeepCopy())); | 105 copy->state_.reset(static_cast<DictionaryValue*>(state_->DeepCopy())); |
106 return copy; | 106 return copy; |
107 } | 107 } |
108 | |
OLD | NEW |