| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/html_viewer/html_frame_properties.h" | 5 #include "components/html_viewer/html_frame_properties.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "mojo/common/common_type_converters.h" | 9 #include "mojo/common/common_type_converters.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 memcpy(&(origin_array.front()), pickle.data(), pickle.size()); | 111 memcpy(&(origin_array.front()), pickle.data(), pickle.size()); |
| 112 return origin_array.Pass(); | 112 return origin_array.Pass(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data) { | 115 url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data) { |
| 116 if (data.is_null()) | 116 if (data.is_null()) |
| 117 return url::Origin(); | 117 return url::Origin(); |
| 118 | 118 |
| 119 CHECK(data.size()); | 119 CHECK(data.size()); |
| 120 CHECK(data.size() < static_cast<size_t>(std::numeric_limits<int>::max())); | 120 CHECK(data.size() < static_cast<size_t>(std::numeric_limits<int>::max())); |
| 121 COMPILE_ASSERT(sizeof(uint8_t) == sizeof(unsigned char), | 121 static_assert(sizeof(uint8_t) == sizeof(unsigned char), |
| 122 uint8_t_same_size_as_unsigned_char); | 122 "uint8_t must be the same size as unsigned char"); |
| 123 const base::Pickle pickle(reinterpret_cast<const char*>(&(data.front())), | 123 const base::Pickle pickle(reinterpret_cast<const char*>(&(data.front())), |
| 124 static_cast<int>(data.size())); | 124 static_cast<int>(data.size())); |
| 125 CHECK(pickle.data()); | 125 CHECK(pickle.data()); |
| 126 base::PickleIterator iter(pickle); | 126 base::PickleIterator iter(pickle); |
| 127 bool unique = false; | 127 bool unique = false; |
| 128 std::string scheme; | 128 std::string scheme; |
| 129 std::string host; | 129 std::string host; |
| 130 uint16_t port = 0; | 130 uint16_t port = 0; |
| 131 CHECK(iter.ReadBool(&unique)); | 131 CHECK(iter.ReadBool(&unique)); |
| 132 CHECK(iter.ReadString(&scheme)); | 132 CHECK(iter.ReadString(&scheme)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 mojo::Array<uint8_t> GetValueFromClientProperties( | 154 mojo::Array<uint8_t> GetValueFromClientProperties( |
| 155 const std::string& name, | 155 const std::string& name, |
| 156 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { | 156 const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { |
| 157 auto iter = properties.find(name); | 157 auto iter = properties.find(name); |
| 158 return iter == properties.end() ? mojo::Array<uint8_t>() | 158 return iter == properties.end() ? mojo::Array<uint8_t>() |
| 159 : iter.GetValue().Clone().Pass(); | 159 : iter.GetValue().Clone().Pass(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace html_viewer | 162 } // namespace html_viewer |
| OLD | NEW |