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

Side by Side Diff: components/arc/test/fake_app_instance.cc

Issue 2763753003: [Merge To M58]Fix Default icon issue when cached icon file is corrupted. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 | « components/arc/test/fake_app_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/arc/test/fake_app_instance.h" 5 #include "components/arc/test/fake_app_instance.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return false; 112 return false;
113 } 113 }
114 114
115 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor, 115 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor,
116 std::vector<uint8_t>(png_data_as_string->begin(), 116 std::vector<uint8_t>(png_data_as_string->begin(),
117 png_data_as_string->end())); 117 png_data_as_string->end()));
118 118
119 return true; 119 return true;
120 } 120 }
121 121
122 void FakeAppInstance::GenerateAndSendBadIcon(const mojom::AppInfo& app,
123 mojom::ScaleFactor scale_factor) {
124 std::vector<uint8_t> badIcon(10, 1);
125 app_host_->OnAppIcon(app.package_name, app.activity, scale_factor, badIcon);
126 }
127
122 bool FakeAppInstance::GetFakeIcon(mojom::ScaleFactor scale_factor, 128 bool FakeAppInstance::GetFakeIcon(mojom::ScaleFactor scale_factor,
123 std::string* png_data_as_string) { 129 std::string* png_data_as_string) {
124 CHECK(png_data_as_string != nullptr); 130 CHECK(png_data_as_string != nullptr);
125 std::string icon_file_name; 131 std::string icon_file_name;
126 switch (scale_factor) { 132 switch (scale_factor) {
127 case mojom::ScaleFactor::SCALE_FACTOR_100P: 133 case mojom::ScaleFactor::SCALE_FACTOR_100P:
128 icon_file_name = "icon_100p.png"; 134 icon_file_name = "icon_100p.png";
129 break; 135 break;
130 case mojom::ScaleFactor::SCALE_FACTOR_125P: 136 case mojom::ScaleFactor::SCALE_FACTOR_125P:
131 icon_file_name = "icon_125p.png"; 137 icon_file_name = "icon_125p.png";
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 std::string png_data_as_string; 268 std::string png_data_as_string;
263 if (GetFakeIcon(scale_factor, &png_data_as_string)) { 269 if (GetFakeIcon(scale_factor, &png_data_as_string)) {
264 callback.Run(std::vector<uint8_t>(png_data_as_string.begin(), 270 callback.Run(std::vector<uint8_t>(png_data_as_string.begin(),
265 png_data_as_string.end())); 271 png_data_as_string.end()));
266 } 272 }
267 } 273 }
268 274
269 void FakeAppInstance::RemoveCachedIcon(const std::string& icon_resource_id) {} 275 void FakeAppInstance::RemoveCachedIcon(const std::string& icon_resource_id) {}
270 276
271 } // namespace arc 277 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/test/fake_app_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698