Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_views.h

Issue 225053004: Refactor views app list services to allow more code sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows is the worst Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_SERVICE_LINUX_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_SERVICE_LINUX_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 9 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
10 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h"
11 #include "chrome/browser/ui/app_list/app_list_shower_views.h"
10 12
11 template <typename T> struct DefaultSingletonTraits; 13 class AppListControllerDelegate;
12 14
13 class AppListShower; 15 // AppListServiceViews manages a desktop app list that uses toolkit-views.
16 class AppListServiceViews : public AppListServiceImpl,
17 public AppListShowerDelegate {
18 public:
19 explicit AppListServiceViews(
20 scoped_ptr<AppListControllerDelegate> controller_delegate);
21 virtual ~AppListServiceViews();
14 22
15 // AppListServiceLinux manages global resources needed for the app list to 23 // Set |can_dismiss| to prevent the app list dismissing when losing focus. For
16 // operate, and controls when the app list is opened and closed. 24 // example, while showing a window-modal dialog.
17 class AppListServiceLinux : public AppListServiceImpl { 25 void set_can_dismiss(bool can_dismiss) { can_dismiss_ = can_dismiss; }
18 public:
19 virtual ~AppListServiceLinux();
20 26
21 static AppListServiceLinux* GetInstance(); 27 AppListShower& shower() { return shower_; }
22 void set_can_close(bool can_close); 28
23 void OnViewBeingDestroyed(); 29 // Called by the AppListControllerDelegate when it is told that the app list
30 // view must be destroyed.
31 virtual void OnViewBeingDestroyed();
24 32
25 // AppListService overrides: 33 // AppListService overrides:
26 virtual void Init(Profile* initial_profile) OVERRIDE; 34 virtual void Init(Profile* initial_profile) OVERRIDE;
27 virtual void CreateForProfile(Profile* requested_profile) OVERRIDE; 35 virtual void CreateForProfile(Profile* requested_profile) OVERRIDE;
28 virtual void ShowForProfile(Profile* requested_profile) OVERRIDE; 36 virtual void ShowForProfile(Profile* requested_profile) OVERRIDE;
29 virtual void DismissAppList() OVERRIDE; 37 virtual void DismissAppList() OVERRIDE;
30 virtual bool IsAppListVisible() const OVERRIDE; 38 virtual bool IsAppListVisible() const OVERRIDE;
31 virtual gfx::NativeWindow GetAppListWindow() OVERRIDE; 39 virtual gfx::NativeWindow GetAppListWindow() OVERRIDE;
32 virtual Profile* GetCurrentAppListProfile() OVERRIDE; 40 virtual Profile* GetCurrentAppListProfile() OVERRIDE;
33 virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE; 41 virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE;
34 42
35 // AppListServiceImpl overrides: 43 // AppListCreatorDelegate overrides:
36 virtual void CreateShortcut() OVERRIDE; 44 virtual AppListControllerDelegate* GetControllerDelegateForCreate() OVERRIDE;
37 45
38 private: 46 private:
39 friend struct DefaultSingletonTraits<AppListServiceLinux>; 47 // Responsible for creating the app list and responding to profile changes.
48 AppListShower shower_;
40 49
41 AppListServiceLinux(); 50 bool can_dismiss_;
42
43 // Responsible for putting views on the screen.
44 scoped_ptr<AppListShower> shower_;
45 scoped_ptr<AppListControllerDelegate> controller_delegate_; 51 scoped_ptr<AppListControllerDelegate> controller_delegate_;
46 52
47 DISALLOW_COPY_AND_ASSIGN(AppListServiceLinux); 53 DISALLOW_COPY_AND_ASSIGN(AppListServiceViews);
48 }; 54 };
49 55
50 #endif // CHROME_BROWSER_UI_VIEWS_APP_LIST_LINUX_APP_LIST_SERVICE_LINUX_H_ 56 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698