| 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 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 5 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
| 6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/app_list/app_list_view_delegate.h" | 13 #include "ui/app_list/app_list_view_delegate.h" |
| 14 | 14 |
| 15 namespace app_list { | 15 namespace app_list { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 class AppListTestModel; | 18 class AppListTestModel; |
| 19 | 19 |
| 20 // A concrete AppListViewDelegate for unit tests. | 20 // A concrete AppListViewDelegate for unit tests. |
| 21 class AppListTestViewDelegate : public AppListViewDelegate { | 21 class AppListTestViewDelegate : public AppListViewDelegate { |
| 22 public: | 22 public: |
| 23 AppListTestViewDelegate(); | 23 AppListTestViewDelegate(); |
| 24 virtual ~AppListTestViewDelegate(); | 24 virtual ~AppListTestViewDelegate(); |
| 25 | 25 |
| 26 int dismiss_count() { return dismiss_count_; } | 26 int dismiss_count() { return dismiss_count_; } |
| 27 int open_search_result_count() { return open_search_result_count_; } |
| 27 void set_test_signin_delegate(SigninDelegate* signin_delegate) { | 28 void set_test_signin_delegate(SigninDelegate* signin_delegate) { |
| 28 test_signin_delegate_ = signin_delegate; | 29 test_signin_delegate_ = signin_delegate; |
| 29 } | 30 } |
| 30 | 31 |
| 31 void SetUsers(const Users& users) { | 32 void SetUsers(const Users& users) { |
| 32 users_ = users; | 33 users_ = users; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // AppListViewDelegate overrides: | 36 // AppListViewDelegate overrides: |
| 36 virtual bool ForceNativeDesktop() const OVERRIDE; | 37 virtual bool ForceNativeDesktop() const OVERRIDE; |
| 37 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {} | 38 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {} |
| 38 virtual AppListModel* GetModel() OVERRIDE; | 39 virtual AppListModel* GetModel() OVERRIDE; |
| 39 virtual SigninDelegate* GetSigninDelegate() OVERRIDE; | 40 virtual SigninDelegate* GetSigninDelegate() OVERRIDE; |
| 40 virtual void GetShortcutPathForApp( | 41 virtual void GetShortcutPathForApp( |
| 41 const std::string& app_id, | 42 const std::string& app_id, |
| 42 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 43 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
| 43 virtual void StartSearch() OVERRIDE {} | 44 virtual void StartSearch() OVERRIDE {} |
| 44 virtual void StopSearch() OVERRIDE {} | 45 virtual void StopSearch() OVERRIDE {} |
| 45 virtual void OpenSearchResult(SearchResult* result, | 46 virtual void OpenSearchResult(SearchResult* result, |
| 46 int event_flags) OVERRIDE {} | 47 int event_flags) OVERRIDE; |
| 47 virtual void InvokeSearchResultAction(SearchResult* result, | 48 virtual void InvokeSearchResultAction(SearchResult* result, |
| 48 int action_index, | 49 int action_index, |
| 49 int event_flags) OVERRIDE {} | 50 int event_flags) OVERRIDE {} |
| 50 virtual void Dismiss() OVERRIDE; | 51 virtual void Dismiss() OVERRIDE; |
| 51 virtual void ViewClosing() OVERRIDE {} | 52 virtual void ViewClosing() OVERRIDE {} |
| 52 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; | 53 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
| 53 virtual void OpenSettings() OVERRIDE {} | 54 virtual void OpenSettings() OVERRIDE {} |
| 54 virtual void OpenHelp() OVERRIDE {} | 55 virtual void OpenHelp() OVERRIDE {} |
| 55 virtual void OpenFeedback() OVERRIDE {} | 56 virtual void OpenFeedback() OVERRIDE {} |
| 56 virtual void ToggleSpeechRecognition() OVERRIDE {} | 57 virtual void ToggleSpeechRecognition() OVERRIDE {} |
| 57 virtual void ShowForProfileByPath( | 58 virtual void ShowForProfileByPath( |
| 58 const base::FilePath& profile_path) OVERRIDE {} | 59 const base::FilePath& profile_path) OVERRIDE {} |
| 59 virtual content::WebContents* GetStartPageContents() OVERRIDE; | 60 virtual content::WebContents* GetStartPageContents() OVERRIDE; |
| 60 virtual const Users& GetUsers() const OVERRIDE; | 61 virtual const Users& GetUsers() const OVERRIDE; |
| 61 | 62 |
| 62 // Do a bulk replacement of the items in the model. | 63 // Do a bulk replacement of the items in the model. |
| 63 void ReplaceTestModel(int item_count); | 64 void ReplaceTestModel(int item_count); |
| 64 | 65 |
| 65 AppListTestModel* GetTestModel() { return model_.get(); } | 66 AppListTestModel* GetTestModel() { return model_.get(); } |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 int dismiss_count_; | 69 int dismiss_count_; |
| 70 int open_search_result_count_; |
| 69 Users users_; | 71 Users users_; |
| 70 SigninDelegate* test_signin_delegate_; // Weak. Owned by test. | 72 SigninDelegate* test_signin_delegate_; // Weak. Owned by test. |
| 71 scoped_ptr<AppListTestModel> model_; | 73 scoped_ptr<AppListTestModel> model_; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace test | 76 } // namespace test |
| 75 } // namespace app_list | 77 } // namespace app_list |
| 76 | 78 |
| 77 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 79 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
| OLD | NEW |