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

Side by Side Diff: chrome/browser/notifications/arc_application_notifier_source_chromeos.cc

Issue 2864243006: [Merge M59] arc: Prevent overwriting of the Chrome Play Store icon. (Closed)
Patch Set: 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
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/notifications/arc_application_notifier_source_chromeos. h" 5 #include "chrome/browser/notifications/arc_application_notifier_source_chromeos. h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (!package || package->system) 54 if (!package || package->system)
55 continue; 55 continue;
56 56
57 // Load icons for notifier. 57 // Load icons for notifier.
58 std::unique_ptr<ArcAppIcon> icon( 58 std::unique_ptr<ArcAppIcon> icon(
59 new ArcAppIcon(profile, app_id, 59 new ArcAppIcon(profile, app_id,
60 // ARC icon is available only for 48x48 dips. 60 // ARC icon is available only for 48x48 dips.
61 kArcAppIconSizeInDp, 61 kArcAppIconSizeInDp,
62 // The life time of icon must shorter than |this|. 62 // The life time of icon must shorter than |this|.
63 this)); 63 this));
64 icon->LoadForScaleFactor( 64 icon->image_skia().GetRepresentation(
65 ui::GetSupportedScaleFactor(display::Screen::GetScreen() 65 ui::GetSupportedScaleFactor(display::Screen::GetScreen()
66 ->GetPrimaryDisplay() 66 ->GetPrimaryDisplay()
67 .device_scale_factor())); 67 .device_scale_factor()));
68 // Apply icon now to set the default image.
69 OnIconUpdated(icon.get());
68 70
69 // Add notifiers. 71 // Add notifiers.
70 package_to_app_ids_.insert(std::make_pair(app->package_name, app_id)); 72 package_to_app_ids_.insert(std::make_pair(app->package_name, app_id));
71 message_center::NotifierId notifier_id( 73 message_center::NotifierId notifier_id(
72 message_center::NotifierId::ARC_APPLICATION, app_id); 74 message_center::NotifierId::ARC_APPLICATION, app_id);
73 std::unique_ptr<message_center::Notifier> notifier( 75 std::unique_ptr<message_center::Notifier> notifier(
74 new message_center::Notifier(notifier_id, base::UTF8ToUTF16(app->name), 76 new message_center::Notifier(notifier_id, base::UTF8ToUTF16(app->name),
75 app->notifications_enabled)); 77 app->notifications_enabled));
76 notifier->icon = icon->image(); 78 notifier->icon = gfx::Image(icon->image_skia());
77 icons_.push_back(std::move(icon)); 79 icons_.push_back(std::move(icon));
78 results.push_back(std::move(notifier)); 80 results.push_back(std::move(notifier));
79 } 81 }
80 82
81 return results; 83 return results;
82 } 84 }
83 85
84 void ArcApplicationNotifierSourceChromeOS::SetNotifierEnabled( 86 void ArcApplicationNotifierSourceChromeOS::SetNotifierEnabled(
85 Profile* profile, 87 Profile* profile,
86 const message_center::Notifier& notifier, 88 const message_center::Notifier& notifier,
(...skipping 23 matching lines...) Expand all
110 112
111 message_center::NotifierId::NotifierType 113 message_center::NotifierId::NotifierType
112 ArcApplicationNotifierSourceChromeOS::GetNotifierType() { 114 ArcApplicationNotifierSourceChromeOS::GetNotifierType() {
113 return message_center::NotifierId::ARC_APPLICATION; 115 return message_center::NotifierId::ARC_APPLICATION;
114 } 116 }
115 117
116 void ArcApplicationNotifierSourceChromeOS::OnIconUpdated(ArcAppIcon* icon) { 118 void ArcApplicationNotifierSourceChromeOS::OnIconUpdated(ArcAppIcon* icon) {
117 observer_->OnIconImageUpdated( 119 observer_->OnIconImageUpdated(
118 message_center::NotifierId(message_center::NotifierId::ARC_APPLICATION, 120 message_center::NotifierId(message_center::NotifierId::ARC_APPLICATION,
119 icon->app_id()), 121 icon->app_id()),
120 icon->image()); 122 gfx::Image(icon->image_skia()));
121 } 123 }
122 124
123 void ArcApplicationNotifierSourceChromeOS::StopObserving() { 125 void ArcApplicationNotifierSourceChromeOS::StopObserving() {
124 if (!last_profile_) 126 if (!last_profile_)
125 return; 127 return;
126 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_); 128 ArcAppListPrefs* const app_list = ArcAppListPrefs::Get(last_profile_);
127 app_list->RemoveObserver(this); 129 app_list->RemoveObserver(this);
128 last_profile_ = nullptr; 130 last_profile_ = nullptr;
129 } 131 }
130 132
131 } // namespace arc 133 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc ('k') | chrome/browser/ui/app_list/arc/arc_app_icon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698