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

Side by Side Diff: content/browser/manifest/manifest_manager_host.cc

Issue 2036803002: [WIP] Use Optional<SkColor> instead of int64 for colors in Manifest. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with unit tests Created 4 years, 4 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 | « no previous file | content/public/common/manifest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/manifest/manifest_manager_host.h" 5 #include "content/browser/manifest/manifest_manager_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/common/manifest_manager_messages.h" 10 #include "content/common/manifest_manager_messages.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 0, Manifest::kMaxIPCStringLength), 134 0, Manifest::kMaxIPCStringLength),
135 manifest.gcm_sender_id.is_null()); 135 manifest.gcm_sender_id.is_null());
136 for (auto& related_application : manifest.related_applications) { 136 for (auto& related_application : manifest.related_applications) {
137 if (!related_application.url.is_valid()) 137 if (!related_application.url.is_valid())
138 related_application.url = GURL(); 138 related_application.url = GURL();
139 related_application.id = 139 related_application.id =
140 base::NullableString16(related_application.id.string().substr( 140 base::NullableString16(related_application.id.string().substr(
141 0, Manifest::kMaxIPCStringLength), 141 0, Manifest::kMaxIPCStringLength),
142 related_application.id.is_null()); 142 related_application.id.is_null());
143 } 143 }
144 // theme_color and background_color are 32 bit unsigned integers with 64 bit
145 // integers simply being used to encode the occurence of an error. Therefore,
146 // any value outside the range of a 32 bit integer is invalid.
147 if (manifest.theme_color < std::numeric_limits<int32_t>::min() ||
148 manifest.theme_color > std::numeric_limits<int32_t>::max())
149 manifest.theme_color = Manifest::kInvalidOrMissingColor;
150 if (manifest.background_color < std::numeric_limits<int32_t>::min() ||
151 manifest.background_color > std::numeric_limits<int32_t>::max())
152 manifest.background_color = Manifest::kInvalidOrMissingColor;
153 144
154 callback->Run(manifest_url, manifest); 145 callback->Run(manifest_url, manifest);
155 callbacks->Remove(request_id); 146 callbacks->Remove(request_id);
156 if (callbacks->IsEmpty()) { 147 if (callbacks->IsEmpty()) {
157 delete callbacks; 148 delete callbacks;
158 pending_get_callbacks_.erase(render_frame_host); 149 pending_get_callbacks_.erase(render_frame_host);
159 } 150 }
160 } 151 }
161 152
162 } // namespace content 153 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/public/common/manifest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698