OLD | NEW |
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 "chrome/browser/extensions/api/file_system/request_file_system_notifica
tion.h" | 5 #include "chrome/browser/extensions/api/file_system/request_file_system_notifica
tion.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 13 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
14 #include "chrome/browser/extensions/extension_app_icon_loader.h" | 14 #include "chrome/browser/extensions/chrome_app_icon_loader.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
19 #include "ui/message_center/notification.h" | 19 #include "ui/message_center/notification.h" |
20 #include "ui/message_center/notification_delegate.h" | 20 #include "ui/message_center/notification_delegate.h" |
21 #include "ui/message_center/notification_types.h" | 21 #include "ui/message_center/notification_types.h" |
22 #include "ui/message_center/notifier_settings.h" | 22 #include "ui/message_center/notifier_settings.h" |
23 | 23 |
24 using file_manager::Volume; | 24 using file_manager::Volume; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 pending_notification_->set_icon(*extension_icon_.get()); | 97 pending_notification_->set_icon(*extension_icon_.get()); |
98 g_browser_process->message_center()->AddNotification( | 98 g_browser_process->message_center()->AddNotification( |
99 std::move(pending_notification_)); | 99 std::move(pending_notification_)); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 RequestFileSystemNotification::RequestFileSystemNotification( | 103 RequestFileSystemNotification::RequestFileSystemNotification( |
104 Profile* profile, | 104 Profile* profile, |
105 const extensions::Extension& extension) | 105 const extensions::Extension& extension) |
106 : icon_loader_( | 106 : icon_loader_( |
107 new extensions::ExtensionAppIconLoader(profile, kIconSize, this)) { | 107 new extensions::ChromeAppIconLoader(profile, kIconSize, this)) { |
108 icon_loader_->FetchImage(extension.id()); | 108 icon_loader_->FetchImage(extension.id()); |
109 } | 109 } |
110 | 110 |
111 RequestFileSystemNotification::~RequestFileSystemNotification() { | 111 RequestFileSystemNotification::~RequestFileSystemNotification() { |
112 } | 112 } |
113 | 113 |
114 void RequestFileSystemNotification::Show( | 114 void RequestFileSystemNotification::Show( |
115 std::unique_ptr<Notification> notification) { | 115 std::unique_ptr<Notification> notification) { |
116 pending_notification_ = std::move(notification); | 116 pending_notification_ = std::move(notification); |
117 // If the extension icon is not known yet, then defer showing the notification | 117 // If the extension icon is not known yet, then defer showing the notification |
118 // until it is (from SetAppImage). | 118 // until it is (from SetAppImage). |
119 if (!extension_icon_) | 119 if (!extension_icon_) |
120 return; | 120 return; |
121 | 121 |
122 pending_notification_->set_icon(*extension_icon_.get()); | 122 pending_notification_->set_icon(*extension_icon_.get()); |
123 g_browser_process->message_center()->AddNotification( | 123 g_browser_process->message_center()->AddNotification( |
124 std::move(pending_notification_)); | 124 std::move(pending_notification_)); |
125 } | 125 } |
OLD | NEW |