| 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 "ui/app_list/test/app_list_test_view_delegate.h" | 5 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "ui/app_list/app_list_model.h" | 11 #include "ui/app_list/app_list_model.h" |
| 12 #include "ui/app_list/app_list_switches.h" | 12 #include "ui/app_list/app_list_switches.h" |
| 13 #include "ui/app_list/app_list_view_delegate_observer.h" | 13 #include "ui/app_list/app_list_view_delegate_observer.h" |
| 14 #include "ui/app_list/signin_delegate.h" | |
| 15 #include "ui/app_list/test/app_list_test_model.h" | 14 #include "ui/app_list/test/app_list_test_model.h" |
| 16 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
| 17 | 16 |
| 18 namespace app_list { | 17 namespace app_list { |
| 19 namespace test { | 18 namespace test { |
| 20 | 19 |
| 21 class TestSigninDelegate : public SigninDelegate { | |
| 22 public: | |
| 23 TestSigninDelegate() : signed_in_(true) {} | |
| 24 | |
| 25 void set_signed_in(bool signed_in) { signed_in_ = signed_in; } | |
| 26 | |
| 27 // SigninDelegate overrides: | |
| 28 virtual bool NeedSignin() OVERRIDE { return !signed_in_; } | |
| 29 virtual void ShowSignin() OVERRIDE {} | |
| 30 virtual void OpenLearnMore() OVERRIDE {} | |
| 31 virtual void OpenSettings() OVERRIDE {} | |
| 32 | |
| 33 virtual base::string16 GetSigninHeading() OVERRIDE { | |
| 34 return base::string16(); | |
| 35 } | |
| 36 virtual base::string16 GetSigninText() OVERRIDE { return base::string16(); } | |
| 37 virtual base::string16 GetSigninButtonText() OVERRIDE { | |
| 38 return base::string16(); | |
| 39 } | |
| 40 virtual base::string16 GetLearnMoreLinkText() OVERRIDE { | |
| 41 return base::string16(); | |
| 42 } | |
| 43 virtual base::string16 GetSettingsLinkText() OVERRIDE { | |
| 44 return base::string16(); | |
| 45 } | |
| 46 | |
| 47 private: | |
| 48 bool signed_in_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(TestSigninDelegate); | |
| 51 }; | |
| 52 | |
| 53 AppListTestViewDelegate::AppListTestViewDelegate() | 20 AppListTestViewDelegate::AppListTestViewDelegate() |
| 54 : dismiss_count_(0), | 21 : dismiss_count_(0), |
| 55 open_search_result_count_(0), | 22 open_search_result_count_(0), |
| 56 test_signin_delegate_(new TestSigninDelegate), | |
| 57 model_(new AppListTestModel), | 23 model_(new AppListTestModel), |
| 58 speech_ui_(SPEECH_RECOGNITION_OFF) { | 24 speech_ui_(SPEECH_RECOGNITION_OFF) { |
| 59 } | 25 } |
| 60 | 26 |
| 61 AppListTestViewDelegate::~AppListTestViewDelegate() {} | 27 AppListTestViewDelegate::~AppListTestViewDelegate() {} |
| 62 | 28 |
| 63 void AppListTestViewDelegate::SetSignedIn(bool signed_in) { | |
| 64 test_signin_delegate_->set_signed_in(signed_in); | |
| 65 FOR_EACH_OBSERVER(AppListViewDelegateObserver, | |
| 66 observers_, | |
| 67 OnProfilesChanged()); | |
| 68 } | |
| 69 | |
| 70 bool AppListTestViewDelegate::ForceNativeDesktop() const { | 29 bool AppListTestViewDelegate::ForceNativeDesktop() const { |
| 71 return false; | 30 return false; |
| 72 } | 31 } |
| 73 | 32 |
| 74 AppListModel* AppListTestViewDelegate::GetModel() { | 33 AppListModel* AppListTestViewDelegate::GetModel() { |
| 75 return model_.get(); | 34 return model_.get(); |
| 76 } | 35 } |
| 77 | 36 |
| 78 SigninDelegate* AppListTestViewDelegate::GetSigninDelegate() { | |
| 79 return test_signin_delegate_.get(); | |
| 80 } | |
| 81 | |
| 82 SpeechUIModel* AppListTestViewDelegate::GetSpeechUI() { | 37 SpeechUIModel* AppListTestViewDelegate::GetSpeechUI() { |
| 83 return &speech_ui_; | 38 return &speech_ui_; |
| 84 } | 39 } |
| 85 | 40 |
| 86 void AppListTestViewDelegate::GetShortcutPathForApp( | 41 void AppListTestViewDelegate::GetShortcutPathForApp( |
| 87 const std::string& app_id, | 42 const std::string& app_id, |
| 88 const base::Callback<void(const base::FilePath&)>& callback) { | 43 const base::Callback<void(const base::FilePath&)>& callback) { |
| 89 callback.Run(base::FilePath()); | 44 callback.Run(base::FilePath()); |
| 90 } | 45 } |
| 91 | 46 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 observers_.AddObserver(observer); | 99 observers_.AddObserver(observer); |
| 145 } | 100 } |
| 146 | 101 |
| 147 void AppListTestViewDelegate::RemoveObserver( | 102 void AppListTestViewDelegate::RemoveObserver( |
| 148 AppListViewDelegateObserver* observer) { | 103 AppListViewDelegateObserver* observer) { |
| 149 observers_.RemoveObserver(observer); | 104 observers_.RemoveObserver(observer); |
| 150 } | 105 } |
| 151 | 106 |
| 152 } // namespace test | 107 } // namespace test |
| 153 } // namespace app_list | 108 } // namespace app_list |
| OLD | NEW |