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

Side by Side Diff: chrome/browser/ui/webui/options2/options_ui2.h

Issue 9104028: Unfork various Sync settings UI classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another cros compilation fix. Created 8 years, 10 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 | Annotate | Revision Log
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 CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
15 #include "chrome/browser/ui/webui/options/options_ui.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
18 #include "content/public/browser/web_ui_controller.h" 19 #include "content/public/browser/web_ui_controller.h"
19 #include "content/public/browser/web_ui_message_handler.h" 20 #include "content/public/browser/web_ui_message_handler.h"
20 21
21 namespace options2 { 22 namespace options2 {
22
23 // The base class handler of Javascript messages of options pages.
24 class OptionsPageUIHandler : public content::WebUIMessageHandler,
25 public content::NotificationObserver {
26 public:
27 OptionsPageUIHandler();
28 virtual ~OptionsPageUIHandler();
29
30 // Is this handler enabled?
31 virtual bool IsEnabled();
32
33 // Collects localized strings for options page.
34 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings) = 0;
35
36 // Initialize the page. Called once the DOM is available for manipulation.
37 // This will be called only once.
38 virtual void Initialize() {}
39
40 // Uninitializes the page. Called just before the object is destructed.
41 virtual void Uninitialize() {}
42
43 // WebUIMessageHandler implementation.
44 virtual void RegisterMessages() OVERRIDE {}
45
46 // content::NotificationObserver implementation.
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE {}
50
51 protected:
52 struct OptionsStringResource {
53 // The name of the resource in templateData.
54 const char* name;
55 // The .grd ID for the resource (IDS_*).
56 int id;
57 };
58 // A helper for simplifying the process of registering strings in WebUI.
59 static void RegisterStrings(base::DictionaryValue* localized_strings,
60 const OptionsStringResource* resources,
61 size_t length);
62
63 // Registers string resources for a page's header and tab title.
64 static void RegisterTitle(base::DictionaryValue* localized_strings,
65 const std::string& variable_name,
66 int title_id);
67
68 content::NotificationRegistrar registrar_;
69
70 private:
71 DISALLOW_COPY_AND_ASSIGN(OptionsPageUIHandler);
72 };
73
74 // An interface for common operations that a host of OptionsPageUIHandlers
75 // should provide.
76 class OptionsPageUIHandlerHost {
77 public:
78 virtual void InitializeHandlers() = 0;
79
80 protected:
81 virtual ~OptionsPageUIHandlerHost() {}
82 };
83
84 // The WebUI for chrome:settings-frame. 23 // The WebUI for chrome:settings-frame.
85 class OptionsUI : public content::WebUIController, 24 class OptionsUI : public content::WebUIController,
86 public OptionsPageUIHandlerHost { 25 public OptionsPageUIHandlerHost {
87 public: 26 public:
88 explicit OptionsUI(content::WebUI* web_ui); 27 explicit OptionsUI(content::WebUI* web_ui);
89 virtual ~OptionsUI(); 28 virtual ~OptionsUI();
90 29
91 static RefCountedMemory* GetFaviconResourceBytes(); 30 static RefCountedMemory* GetFaviconResourceBytes();
92 31
93 // WebUIController implementation. 32 // WebUIController implementation.
(...skipping 16 matching lines...) Expand all
110 bool initialized_handlers_; 49 bool initialized_handlers_;
111 50
112 std::vector<OptionsPageUIHandler*> handlers_; 51 std::vector<OptionsPageUIHandler*> handlers_;
113 52
114 DISALLOW_COPY_AND_ASSIGN(OptionsUI); 53 DISALLOW_COPY_AND_ASSIGN(OptionsUI);
115 }; 54 };
116 55
117 } // namespace options2 56 } // namespace options2
118 57
119 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_ 58 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI2_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/options_sync_setup_handler2.cc ('k') | chrome/browser/ui/webui/options2/options_ui2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698