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

Side by Side Diff: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc

Issue 2865813002: arc: Prevent overwriting of the Chrome Play Store icon. (Closed)
Patch Set: discard image(), protect LoadImageForScaleFactor Created 3 years, 7 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 | chrome/browser/notifications/arc_application_notifier_source_chromeos.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h> 5 #include <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h>
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.h" 8 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ArcKioskAppService::~ArcKioskAppService() { 167 ArcKioskAppService::~ArcKioskAppService() {
168 maintenance_timeout_timer_.Stop(); 168 maintenance_timeout_timer_.Stop();
169 } 169 }
170 170
171 void ArcKioskAppService::RequestNameAndIconUpdate() { 171 void ArcKioskAppService::RequestNameAndIconUpdate() {
172 // Request only once when app_icon_ is not initialized. 172 // Request only once when app_icon_ is not initialized.
173 if (!app_info_ || !app_info_->ready || app_icon_) 173 if (!app_info_ || !app_info_->ready || app_icon_)
174 return; 174 return;
175 app_icon_ = base::MakeUnique<ArcAppIcon>(profile_, app_id_, 175 app_icon_ = base::MakeUnique<ArcAppIcon>(profile_, app_id_,
176 app_list::kGridIconDimension, this); 176 app_list::kGridIconDimension, this);
177 app_icon_->LoadForScaleFactor(ui::GetSupportedScaleFactor( 177 app_icon_->image_skia().GetRepresentation(ui::GetSupportedScaleFactor(
178 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor())); 178 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()));
179 // Name and icon are updated when icon is loaded in OnIconUpdated() 179 // Apply default image now and in case icon is updated then OnIconUpdated()
180 // will be called additionally.
181 OnIconUpdated(app_icon_.get());
180 } 182 }
181 183
182 void ArcKioskAppService::PreconditionsChanged() { 184 void ArcKioskAppService::PreconditionsChanged() {
183 VLOG(2) << "Preconditions for kiosk app changed"; 185 VLOG(2) << "Preconditions for kiosk app changed";
184 app_id_ = GetAppId(); 186 app_id_ = GetAppId();
185 if (app_id_.empty()) { 187 if (app_id_.empty()) {
186 VLOG(2) << "Kiosk app is not available"; 188 VLOG(2) << "Kiosk app is not available";
187 return; 189 return;
188 } 190 }
189 app_info_ = ArcAppListPrefs::Get(profile_)->GetApp(app_id_); 191 app_info_ = ArcAppListPrefs::Get(profile_)->GetApp(app_id_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return std::string(); 224 return std::string();
223 // If |activity| and |intent| are not specified, return any app from the 225 // If |activity| and |intent| are not specified, return any app from the
224 // package. 226 // package.
225 if (app->activity().empty() && app->intent().empty()) 227 if (app->activity().empty() && app->intent().empty())
226 return *app_ids.begin(); 228 return *app_ids.begin();
227 // Check that the app is registered for given package. 229 // Check that the app is registered for given package.
228 return app_ids.count(app->app_id()) ? app->app_id() : std::string(); 230 return app_ids.count(app->app_id()) ? app->app_id() : std::string();
229 } 231 }
230 232
231 } // namespace chromeos 233 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/arc_application_notifier_source_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698