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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/notification_manager.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 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 "chrome/browser/chromeos/file_system_provider/notification_manager.h" 5 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_app_icon_loader.h" 10 #include "chrome/browser/extensions/extension_app_icon_loader.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 OnNotificationResult(CONTINUE); 99 OnNotificationResult(CONTINUE);
100 } 100 }
101 101
102 void NotificationManager::OnAppImageUpdated(const std::string& id, 102 void NotificationManager::OnAppImageUpdated(const std::string& id,
103 const gfx::ImageSkia& image) { 103 const gfx::ImageSkia& image) {
104 extension_icon_.reset(new gfx::Image(image)); 104 extension_icon_.reset(new gfx::Image(image));
105 g_browser_process->message_center()->UpdateNotification( 105 g_browser_process->message_center()->UpdateNotification(
106 file_system_info_.mount_path().value(), CreateNotification()); 106 file_system_info_.mount_path().value(), CreateNotification());
107 } 107 }
108 108
109 scoped_ptr<message_center::Notification> 109 std::unique_ptr<message_center::Notification>
110 NotificationManager::CreateNotification() { 110 NotificationManager::CreateNotification() {
111 if (!extension_icon_.get()) 111 if (!extension_icon_.get())
112 icon_loader_->FetchImage(file_system_info_.extension_id()); 112 icon_loader_->FetchImage(file_system_info_.extension_id());
113 113
114 message_center::RichNotificationData rich_notification_data; 114 message_center::RichNotificationData rich_notification_data;
115 rich_notification_data.buttons.push_back( 115 rich_notification_data.buttons.push_back(
116 message_center::ButtonInfo(l10n_util::GetStringUTF16( 116 message_center::ButtonInfo(l10n_util::GetStringUTF16(
117 IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_ABORT_BUTTON))); 117 IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_ABORT_BUTTON)));
118 118
119 message_center::NotifierId notifier_id( 119 message_center::NotifierId notifier_id(
120 message_center::NotifierId::SYSTEM_COMPONENT, 120 message_center::NotifierId::SYSTEM_COMPONENT,
121 file_system_info_.mount_path().value()); 121 file_system_info_.mount_path().value());
122 notifier_id.profile_id = 122 notifier_id.profile_id =
123 multi_user_util::GetAccountIdFromProfile(profile_).GetUserEmail(); 123 multi_user_util::GetAccountIdFromProfile(profile_).GetUserEmail();
124 124
125 scoped_ptr<message_center::Notification> notification( 125 std::unique_ptr<message_center::Notification> notification(
126 new message_center::Notification( 126 new message_center::Notification(
127 message_center::NOTIFICATION_TYPE_SIMPLE, 127 message_center::NOTIFICATION_TYPE_SIMPLE,
128 file_system_info_.mount_path().value(), 128 file_system_info_.mount_path().value(),
129 base::UTF8ToUTF16(file_system_info_.display_name()), 129 base::UTF8ToUTF16(file_system_info_.display_name()),
130 l10n_util::GetStringUTF16( 130 l10n_util::GetStringUTF16(
131 callbacks_.size() == 1 131 callbacks_.size() == 1
132 ? IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_WARNING 132 ? IDS_FILE_SYSTEM_PROVIDER_UNRESPONSIVE_WARNING
133 : IDS_FILE_SYSTEM_PROVIDER_MANY_UNRESPONSIVE_WARNING), 133 : IDS_FILE_SYSTEM_PROVIDER_MANY_UNRESPONSIVE_WARNING),
134 extension_icon_.get() ? *extension_icon_.get() : gfx::Image(), 134 extension_icon_.get() ? *extension_icon_.get() : gfx::Image(),
135 base::string16(), // display_source 135 base::string16(), // display_source
136 GURL(), notifier_id, rich_notification_data, 136 GURL(), notifier_id, rich_notification_data,
137 new ProviderNotificationDelegate(this))); 137 new ProviderNotificationDelegate(this)));
138 138
139 notification->SetSystemPriority(); 139 notification->SetSystemPriority();
140 return notification; 140 return notification;
141 } 141 }
142 142
143 void NotificationManager::OnNotificationResult(NotificationResult result) { 143 void NotificationManager::OnNotificationResult(NotificationResult result) {
144 CallbackMap::iterator it = callbacks_.begin(); 144 CallbackMap::iterator it = callbacks_.begin();
145 while (it != callbacks_.end()) { 145 while (it != callbacks_.end()) {
146 CallbackMap::iterator current_it = it++; 146 CallbackMap::iterator current_it = it++;
147 NotificationCallback callback = current_it->second; 147 NotificationCallback callback = current_it->second;
148 callbacks_.erase(current_it); 148 callbacks_.erase(current_it);
149 callback.Run(result); 149 callback.Run(result);
150 } 150 }
151 } 151 }
152 152
153 } // namespace file_system_provider 153 } // namespace file_system_provider
154 } // namespace chromeos 154 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698