OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/page_state_serialization.h" | 5 #include "content/common/page_state_serialization.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 WriteFrameState(state.top, obj, true); | 609 WriteFrameState(state.top, obj, true); |
610 } | 610 } |
611 | 611 |
612 void ReadPageState(SerializeObject* obj, ExplodedPageState* state) { | 612 void ReadPageState(SerializeObject* obj, ExplodedPageState* state) { |
613 obj->version = ReadInteger(obj); | 613 obj->version = ReadInteger(obj); |
614 | 614 |
615 if (obj->version == -1) { | 615 if (obj->version == -1) { |
616 GURL url = ReadGURL(obj); | 616 GURL url = ReadGURL(obj); |
617 // NOTE: GURL::possibly_invalid_spec() always returns valid UTF-8. | 617 // NOTE: GURL::possibly_invalid_spec() always returns valid UTF-8. |
618 state->top.url_string = state->top.original_url_string = | 618 state->top.url_string = state->top.original_url_string = |
619 base::NullableString16(UTF8ToUTF16(url.possibly_invalid_spec()), false); | 619 base::NullableString16( |
| 620 base::UTF8ToUTF16(url.possibly_invalid_spec()), false); |
620 return; | 621 return; |
621 } | 622 } |
622 | 623 |
623 if (obj->version > kCurrentVersion || obj->version < kMinVersion) { | 624 if (obj->version > kCurrentVersion || obj->version < kMinVersion) { |
624 obj->parse_error = true; | 625 obj->parse_error = true; |
625 return; | 626 return; |
626 } | 627 } |
627 | 628 |
628 if (obj->version >= 14) | 629 if (obj->version >= 14) |
629 ReadStringVector(obj, &state->referenced_files); | 630 ReadStringVector(obj, &state->referenced_files); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 float device_scale_factor, | 703 float device_scale_factor, |
703 ExplodedPageState* exploded) { | 704 ExplodedPageState* exploded) { |
704 g_device_scale_factor_for_testing = device_scale_factor; | 705 g_device_scale_factor_for_testing = device_scale_factor; |
705 bool rv = DecodePageState(encoded, exploded); | 706 bool rv = DecodePageState(encoded, exploded); |
706 g_device_scale_factor_for_testing = 0.0; | 707 g_device_scale_factor_for_testing = 0.0; |
707 return rv; | 708 return rv; |
708 } | 709 } |
709 #endif | 710 #endif |
710 | 711 |
711 } // namespace content | 712 } // namespace content |
OLD | NEW |