| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_manager/desktop_notifications.h" | 5 #include "chrome/browser/chromeos/file_manager/desktop_notifications.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 explicit RecordedDesktopNotifications(Profile* profile) | 23 explicit RecordedDesktopNotifications(Profile* profile) |
| 24 : DesktopNotifications(profile) { | 24 : DesktopNotifications(profile) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual ~RecordedDesktopNotifications() {} | 27 virtual ~RecordedDesktopNotifications() {} |
| 28 | 28 |
| 29 virtual void ShowNotificationWithMessage( | 29 virtual void ShowNotificationWithMessage( |
| 30 NotificationType type, | 30 NotificationType type, |
| 31 const std::string& path, | 31 const std::string& path, |
| 32 const string16& message) OVERRIDE { | 32 const base::string16& message) OVERRIDE { |
| 33 ShowAndHideParams params; | 33 ShowAndHideParams params; |
| 34 params.event = SHOW; | 34 params.event = SHOW; |
| 35 params.type = type; | 35 params.type = type; |
| 36 params.path = path; | 36 params.path = path; |
| 37 params.message = message; | 37 params.message = message; |
| 38 params_.push_back(params); | 38 params_.push_back(params); |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual void HideNotification(NotificationType type, | 41 virtual void HideNotification(NotificationType type, |
| 42 const std::string& path) OVERRIDE { | 42 const std::string& path) OVERRIDE { |
| 43 ShowAndHideParams params; | 43 ShowAndHideParams params; |
| 44 params.event = HIDE; | 44 params.event = HIDE; |
| 45 params.type = type; | 45 params.type = type; |
| 46 params.path = path; | 46 params.path = path; |
| 47 params_.push_back(params); | 47 params_.push_back(params); |
| 48 } | 48 } |
| 49 | 49 |
| 50 enum Event { | 50 enum Event { |
| 51 SHOW, | 51 SHOW, |
| 52 HIDE, | 52 HIDE, |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Used to record parameters passed to ShowNotificationWithMessage() and | 55 // Used to record parameters passed to ShowNotificationWithMessage() and |
| 56 // HideNotification(). | 56 // HideNotification(). |
| 57 struct ShowAndHideParams { | 57 struct ShowAndHideParams { |
| 58 Event event; | 58 Event event; |
| 59 NotificationType type; | 59 NotificationType type; |
| 60 std::string path; | 60 std::string path; |
| 61 string16 message; // Empty for HideNotification(). | 61 base::string16 message; // Empty for HideNotification(). |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Returns parameters passed to ShowNotificationWithMessage() and | 64 // Returns parameters passed to ShowNotificationWithMessage() and |
| 65 // HideNotificationParams(). | 65 // HideNotificationParams(). |
| 66 const std::vector<ShowAndHideParams>& params() const { | 66 const std::vector<ShowAndHideParams>& params() const { |
| 67 return params_; | 67 return params_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 std::vector<ShowAndHideParams> params_; | 71 std::vector<ShowAndHideParams> params_; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 notification_path, | 416 notification_path, |
| 417 device_label, | 417 device_label, |
| 418 false /* is_parent */, | 418 false /* is_parent */, |
| 419 false /* success */, | 419 false /* success */, |
| 420 false /* is_unsupported */); | 420 false /* is_unsupported */); |
| 421 EXPECT_EQ(6U, notifications.params().size()); | 421 EXPECT_EQ(6U, notifications.params().size()); |
| 422 // Should do nothing this time. | 422 // Should do nothing this time. |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace file_manager. | 425 } // namespace file_manager. |
| OLD | NEW |