OLD | NEW |
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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 9 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 explicit ProviderNotificationDelegate( | 31 explicit ProviderNotificationDelegate( |
32 NotificationManager* notification_manager) | 32 NotificationManager* notification_manager) |
33 : notification_manager_(notification_manager) {} | 33 : notification_manager_(notification_manager) {} |
34 | 34 |
35 virtual void ButtonClick(int button_index) override { | 35 virtual void ButtonClick(int button_index) override { |
36 notification_manager_->OnButtonClick(button_index); | 36 notification_manager_->OnButtonClick(button_index); |
37 } | 37 } |
38 | 38 |
39 virtual void Display() override {} | 39 virtual void Display() override {} |
40 | 40 |
41 virtual void Error() override { notification_manager_->OnError(); } | |
42 | |
43 virtual void Close(bool by_user) override { | 41 virtual void Close(bool by_user) override { |
44 notification_manager_->OnClose(); | 42 notification_manager_->OnClose(); |
45 } | 43 } |
46 | 44 |
47 virtual void Click() override {} | 45 virtual void Click() override {} |
48 | 46 |
49 private: | 47 private: |
50 virtual ~ProviderNotificationDelegate() {} | 48 virtual ~ProviderNotificationDelegate() {} |
51 NotificationManager* notification_manager_; // Not owned. | 49 NotificationManager* notification_manager_; // Not owned. |
52 | 50 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 92 } |
95 | 93 |
96 g_browser_process->message_center()->RemoveNotification( | 94 g_browser_process->message_center()->RemoveNotification( |
97 file_system_info_.mount_path().value(), false /* by_user */); | 95 file_system_info_.mount_path().value(), false /* by_user */); |
98 } | 96 } |
99 | 97 |
100 void NotificationManager::OnButtonClick(int button_index) { | 98 void NotificationManager::OnButtonClick(int button_index) { |
101 OnNotificationResult(ABORT); | 99 OnNotificationResult(ABORT); |
102 } | 100 } |
103 | 101 |
104 void NotificationManager::OnError() { | |
105 OnNotificationResult(CONTINUE); | |
106 } | |
107 | |
108 void NotificationManager::OnClose() { | 102 void NotificationManager::OnClose() { |
109 OnNotificationResult(CONTINUE); | 103 OnNotificationResult(CONTINUE); |
110 } | 104 } |
111 | 105 |
112 void NotificationManager::SetAppImage(const std::string& id, | 106 void NotificationManager::SetAppImage(const std::string& id, |
113 const gfx::ImageSkia& image) { | 107 const gfx::ImageSkia& image) { |
114 extension_icon_.reset(new gfx::Image(image)); | 108 extension_icon_.reset(new gfx::Image(image)); |
115 g_browser_process->message_center()->UpdateNotification( | 109 g_browser_process->message_center()->UpdateNotification( |
116 file_system_info_.mount_path().value(), CreateNotification()); | 110 file_system_info_.mount_path().value(), CreateNotification()); |
117 } | 111 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 while (it != callbacks_.end()) { | 146 while (it != callbacks_.end()) { |
153 CallbackMap::iterator current_it = it++; | 147 CallbackMap::iterator current_it = it++; |
154 NotificationCallback callback = current_it->second; | 148 NotificationCallback callback = current_it->second; |
155 callbacks_.erase(current_it); | 149 callbacks_.erase(current_it); |
156 callback.Run(result); | 150 callback.Run(result); |
157 } | 151 } |
158 } | 152 } |
159 | 153 |
160 } // namespace file_system_provider | 154 } // namespace file_system_provider |
161 } // namespace chromeos | 155 } // namespace chromeos |
OLD | NEW |