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

Side by Side Diff: chrome/browser/extensions/extension_toolstrip_api.h

Issue 274059: Small cleanup to extension function registration to avoid scattered definitions. (Closed)
Patch Set: Created 11 years, 2 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_
7 7
8 #include "chrome/browser/extensions/extension_function.h" 8 #include "chrome/browser/extensions/extension_function.h"
9 #include "chrome/browser/extensions/extension_shelf_model.h" 9 #include "chrome/browser/extensions/extension_shelf_model.h"
10 10
11 class Profile; 11 class Profile;
12 12
13 // Function names.
14 namespace extension_toolstrip_api_functions {
15 extern const char kExpandFunction[];
16 extern const char kCollapseFunction[];
17 }; // namespace extension_toolstrip_api_functions
18
19 namespace extension_toolstrip_api_events { 13 namespace extension_toolstrip_api_events {
20 extern const char kOnToolstripExpanded[]; 14 extern const char kOnToolstripExpanded[];
21 extern const char kOnToolstripCollapsed[]; 15 extern const char kOnToolstripCollapsed[];
22 }; // namespace extension_toolstrip_api_events 16 }; // namespace extension_toolstrip_api_events
23 17
24 class ToolstripFunction : public SyncExtensionFunction { 18 class ToolstripFunction : public SyncExtensionFunction {
25 protected: 19 protected:
26 virtual bool RunImpl(); 20 virtual bool RunImpl();
27 21
28 ExtensionShelfModel* model_; 22 ExtensionShelfModel* model_;
29 ExtensionShelfModel::iterator toolstrip_; 23 ExtensionShelfModel::iterator toolstrip_;
30 }; 24 };
31 25
32 class ToolstripExpandFunction : public ToolstripFunction { 26 class ToolstripExpandFunction : public ToolstripFunction {
33 virtual bool RunImpl(); 27 virtual bool RunImpl();
28 DECLARE_EXTENSION_FUNCTION_NAME("toolstrip.expand")
34 }; 29 };
35 30
36 class ToolstripCollapseFunction : public ToolstripFunction { 31 class ToolstripCollapseFunction : public ToolstripFunction {
37 virtual bool RunImpl(); 32 virtual bool RunImpl();
33 DECLARE_EXTENSION_FUNCTION_NAME("toolstrip.collapse")
38 }; 34 };
39 35
40 class ToolstripEventRouter { 36 class ToolstripEventRouter {
41 public: 37 public:
42 // Toolstrip events. 38 // Toolstrip events.
43 static void OnToolstripExpanded(Profile* profile, 39 static void OnToolstripExpanded(Profile* profile,
44 int routing_id, 40 int routing_id,
45 const GURL& url, 41 const GURL& url,
46 int height); 42 int height);
47 static void OnToolstripCollapsed(Profile* profile, 43 static void OnToolstripCollapsed(Profile* profile,
48 int routing_id, 44 int routing_id,
49 const GURL& url); 45 const GURL& url);
50 46
51 private: 47 private:
52 // Helper to actually dispatch an event to extension listeners. 48 // Helper to actually dispatch an event to extension listeners.
53 static void DispatchEvent(Profile* profile, 49 static void DispatchEvent(Profile* profile,
54 int routing_id, 50 int routing_id,
55 const char* event_name, 51 const char* event_name,
56 const Value& json); 52 const Value& json);
57 53
58 DISALLOW_COPY_AND_ASSIGN(ToolstripEventRouter); 54 DISALLOW_COPY_AND_ASSIGN(ToolstripEventRouter);
59 }; 55 };
60 56
61 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_ 57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TOOLSTRIP_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698