OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell/example_factory.h" | 9 #include "ash/shell/example_factory.h" |
10 #include "ash/shell/toplevel_window.h" | 10 #include "ash/shell/toplevel_window.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 switch (type) { | 92 switch (type) { |
93 case WIDGETS_WINDOW: | 93 case WIDGETS_WINDOW: |
94 return "Creates a window to show example widgets"; | 94 return "Creates a window to show example widgets"; |
95 case EXAMPLES_WINDOW: | 95 case EXAMPLES_WINDOW: |
96 return "Creates a window to show views example."; | 96 return "Creates a window to show views example."; |
97 default: | 97 default: |
98 return std::string(); | 98 return std::string(); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 static void Activate(Type type, int event_flags) { | 102 static void ActivateItem(Type type, int event_flags) { |
103 switch (type) { | 103 switch (type) { |
104 case TOPLEVEL_WINDOW: { | 104 case TOPLEVEL_WINDOW: { |
105 ToplevelWindow::CreateParams params; | 105 ToplevelWindow::CreateParams params; |
106 params.can_resize = true; | 106 params.can_resize = true; |
107 ToplevelWindow::CreateToplevelWindow(params); | 107 ToplevelWindow::CreateToplevelWindow(params); |
108 break; | 108 break; |
109 } | 109 } |
110 case NON_RESIZABLE_WINDOW: { | 110 case NON_RESIZABLE_WINDOW: { |
111 ToplevelWindow::CreateToplevelWindow(ToplevelWindow::CreateParams()); | 111 ToplevelWindow::CreateToplevelWindow(ToplevelWindow::CreateParams()); |
112 break; | 112 break; |
(...skipping 10 matching lines...) Expand all Loading... |
123 views::examples::ShowExamplesWindowWithContent( | 123 views::examples::ShowExamplesWindowWithContent( |
124 views::examples::DO_NOTHING_ON_CLOSE, | 124 views::examples::DO_NOTHING_ON_CLOSE, |
125 ash::Shell::GetInstance()->browser_context()); | 125 ash::Shell::GetInstance()->browser_context()); |
126 break; | 126 break; |
127 } | 127 } |
128 default: | 128 default: |
129 break; | 129 break; |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 void Activate(int event_flags) { | 133 // AppListItemModel |
134 Activate(type_, event_flags); | 134 virtual void Activate(int event_flags) OVERRIDE { |
| 135 ActivateItem(type_, event_flags); |
135 } | 136 } |
136 | 137 |
137 private: | 138 private: |
138 Type type_; | 139 Type type_; |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncherItem); | 141 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncherItem); |
141 }; | 142 }; |
142 | 143 |
143 // ExampleSearchResult is an app list search result. It provides what icon to | 144 // ExampleSearchResult is an app list search result. It provides what icon to |
144 // show, what should title and details text look like. It also carries the | 145 // show, what should title and details text look like. It also carries the |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 234 |
234 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE { | 235 virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE { |
235 return NULL; | 236 return NULL; |
236 } | 237 } |
237 | 238 |
238 virtual void GetShortcutPathForApp( | 239 virtual void GetShortcutPathForApp( |
239 const std::string& app_id, | 240 const std::string& app_id, |
240 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE { | 241 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE { |
241 } | 242 } |
242 | 243 |
243 virtual void ActivateAppListItem(app_list::AppListItemModel* item, | |
244 int event_flags) OVERRIDE { | |
245 static_cast<WindowTypeLauncherItem*>(item)->Activate(event_flags); | |
246 } | |
247 | |
248 virtual void OpenSearchResult(app_list::SearchResult* result, | 244 virtual void OpenSearchResult(app_list::SearchResult* result, |
249 int event_flags) OVERRIDE { | 245 int event_flags) OVERRIDE { |
250 const ExampleSearchResult* example_result = | 246 const ExampleSearchResult* example_result = |
251 static_cast<const ExampleSearchResult*>(result); | 247 static_cast<const ExampleSearchResult*>(result); |
252 WindowTypeLauncherItem::Activate(example_result->type(), event_flags); | 248 WindowTypeLauncherItem::ActivateItem(example_result->type(), event_flags); |
253 } | 249 } |
254 | 250 |
255 virtual void InvokeSearchResultAction(app_list::SearchResult* result, | 251 virtual void InvokeSearchResultAction(app_list::SearchResult* result, |
256 int action_index, | 252 int action_index, |
257 int event_flags) OVERRIDE { | 253 int event_flags) OVERRIDE { |
258 NOTIMPLEMENTED(); | 254 NOTIMPLEMENTED(); |
259 } | 255 } |
260 | 256 |
261 virtual void StartSearch() OVERRIDE { | 257 virtual void StartSearch() OVERRIDE { |
262 base::string16 query; | 258 base::string16 query; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 }; | 323 }; |
328 | 324 |
329 } // namespace | 325 } // namespace |
330 | 326 |
331 app_list::AppListViewDelegate* CreateAppListViewDelegate() { | 327 app_list::AppListViewDelegate* CreateAppListViewDelegate() { |
332 return new ExampleAppListViewDelegate; | 328 return new ExampleAppListViewDelegate; |
333 } | 329 } |
334 | 330 |
335 } // namespace shell | 331 } // namespace shell |
336 } // namespace ash | 332 } // namespace ash |
OLD | NEW |