1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "athena/home/app_list_view_delegate.h"
#include <string>
#include <vector>
#include "athena/home/public/app_model_builder.h"
#include "athena/home/public/search_controller_factory.h"
#include "athena/strings/grit/athena_strings.h"
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/app_list/app_list_model.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/search_controller.h"
#include "ui/app_list/search_provider.h"
#include "ui/app_list/search_result.h"
#include "ui/app_list/speech_ui_model.h"
#include "ui/base/l10n/l10n_util.h"
namespace athena {
AppListViewDelegate::AppListViewDelegate(
AppModelBuilder* model_builder,
SearchControllerFactory* search_factory)
: model_(new app_list::AppListModel),
speech_ui_(new app_list::SpeechUIModel) {
model_builder->RegisterAppListModel(model_.get());
model_->search_box()->SetHintText(
l10n_util::GetStringUTF16(IDS_ATHENA_SEARCH_BOX_HINT));
if (search_factory) {
search_controller_ =
search_factory->Create(model_->search_box(), model_->results());
}
}
AppListViewDelegate::~AppListViewDelegate() {
}
bool AppListViewDelegate::ForceNativeDesktop() const {
return false;
}
void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) {
// Nothing needs to be done.
}
app_list::AppListModel* AppListViewDelegate::GetModel() {
return model_.get();
}
app_list::SpeechUIModel* AppListViewDelegate::GetSpeechUI() {
return speech_ui_.get();
}
void AppListViewDelegate::GetShortcutPathForApp(
const std::string& app_id,
const base::Callback<void(const base::FilePath&)>& callback) {
// Windows only, nothing is necessary.
}
void AppListViewDelegate::StartSearch() {
if (search_controller_)
search_controller_->Start();
}
void AppListViewDelegate::StopSearch() {
if (search_controller_)
search_controller_->Stop();
}
void AppListViewDelegate::OpenSearchResult(app_list::SearchResult* result,
bool auto_launch,
int event_flags) {
if (search_controller_)
search_controller_->OpenResult(result, event_flags);
}
void AppListViewDelegate::InvokeSearchResultAction(
app_list::SearchResult* result,
int action_index,
int event_flags) {
if (search_controller_)
search_controller_->InvokeResultAction(result, action_index, event_flags);
}
base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() {
// Used by voice search, nothing needs to be done for now.
return base::TimeDelta();
}
void AppListViewDelegate::AutoLaunchCanceled() {
// Used by voice search, nothing needs to be done for now.
}
void AppListViewDelegate::ViewInitialized() {
// Nothing needs to be done.
}
void AppListViewDelegate::Dismiss() {
// Nothing needs to be done.
}
void AppListViewDelegate::ViewClosing() {
// Nothing needs to be done.
}
gfx::ImageSkia AppListViewDelegate::GetWindowIcon() {
return gfx::ImageSkia();
}
void AppListViewDelegate::OpenSettings() {
// Nothing needs to be done for now.
// TODO(mukai): should invoke the settings app.
}
void AppListViewDelegate::OpenHelp() {
// Nothing needs to be done for now.
// TODO(mukai): should invoke the help app.
}
void AppListViewDelegate::OpenFeedback() {
// Nothing needs to be done for now.
// TODO(mukai): should invoke the feedback app.
}
void AppListViewDelegate::ToggleSpeechRecognition() {
// Nothing needs to be done.
}
void AppListViewDelegate::ShowForProfileByPath(
const base::FilePath& profile_path) {
// Nothing needs to be done.
}
views::View* AppListViewDelegate::CreateStartPageWebView(
const gfx::Size& size) {
return NULL;
}
std::vector<views::View*> AppListViewDelegate::CreateCustomPageWebViews(
const gfx::Size& size) {
return std::vector<views::View*>();
}
bool AppListViewDelegate::IsSpeechRecognitionEnabled() {
return false;
}
const app_list::AppListViewDelegate::Users&
AppListViewDelegate::GetUsers() const {
return users_;
}
bool AppListViewDelegate::ShouldCenterWindow() const {
return true;
}
} // namespace athena
|