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

Side by Side Diff: ui/views/focus/focus_manager_factory.h

Issue 2953243002: FocusManagerFactory::Create() should return a unique_ptr. (Closed)
Patch Set: build Created 3 years, 6 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
« no previous file with comments | « ash/accelerators/ash_focus_manager_factory.cc ('k') | ui/views/focus/focus_manager_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_ 5 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_
6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_ 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "ui/views/views_export.h" 11 #include "ui/views/views_export.h"
10 12
11 namespace views { 13 namespace views {
12 14
13 class FocusManager; 15 class FocusManager;
14 class Widget; 16 class Widget;
15 17
16 // A factory to create FocusManager. This is used in unit tests 18 // A factory to create FocusManager. This is used in unit tests
17 // to inject a custom factory. 19 // to inject a custom factory.
18 class VIEWS_EXPORT FocusManagerFactory { 20 class VIEWS_EXPORT FocusManagerFactory {
19 public: 21 public:
20 // Create a FocusManager for the given |widget| using installe Factory. 22 // Create a FocusManager for the given |widget| using the installed Factory.
21 static FocusManager* Create(Widget* widget, bool desktop_widget); 23 static std::unique_ptr<FocusManager> Create(Widget* widget,
24 bool desktop_widget);
22 25
23 // Installs FocusManagerFactory. If |factory| is NULL, it resets 26 // Installs FocusManagerFactory. If |factory| is NULL, it resets
24 // to the default factory which creates plain FocusManager. 27 // to the default factory which creates plain FocusManager.
25 static void Install(FocusManagerFactory* factory); 28 static void Install(FocusManagerFactory* factory);
26 29
27 protected: 30 protected:
28 FocusManagerFactory(); 31 FocusManagerFactory();
29 virtual ~FocusManagerFactory(); 32 virtual ~FocusManagerFactory();
30 33
31 // Create a FocusManager for the given |widget|. 34 // Create a FocusManager for the given |widget|.
32 // The |desktop_widget| bool is true for widgets created in the desktop and 35 // The |desktop_widget| bool is true for widgets created in the desktop and
33 // false for widgets created in the shell. 36 // false for widgets created in the shell.
34 virtual FocusManager* CreateFocusManager(Widget* widget, 37 virtual std::unique_ptr<FocusManager> CreateFocusManager(
35 bool desktop_widget) = 0; 38 Widget* widget,
39 bool desktop_widget) = 0;
36 40
37 private: 41 private:
38 DISALLOW_COPY_AND_ASSIGN(FocusManagerFactory); 42 DISALLOW_COPY_AND_ASSIGN(FocusManagerFactory);
39 }; 43 };
40 44
41 } // namespace views 45 } // namespace views
42 46
43 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_ 47 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_FACTORY_H_
OLDNEW
« no previous file with comments | « ash/accelerators/ash_focus_manager_factory.cc ('k') | ui/views/focus/focus_manager_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698