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

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

Issue 8930012: Revert 114236 - Options2: Pull the trigger. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
14 #include "chrome/browser/ui/webui/chrome_web_ui.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_types.h"
18
19 // The base class handler of Javascript messages of options pages.
20 class OptionsPage2UIHandler : public WebUIMessageHandler,
21 public content::NotificationObserver {
22 public:
23 OptionsPage2UIHandler();
24 virtual ~OptionsPage2UIHandler();
25
26 // Is this handler enabled?
27 virtual bool IsEnabled();
28
29 // Collects localized strings for options page.
30 virtual void GetLocalizedValues(base::DictionaryValue* localized_strings) = 0;
31
32 // Initialize the page. Called once the DOM is available for manipulation.
33 // This will be called only once.
34 virtual void Initialize() {}
35
36 // Uninitializes the page. Called just before the object is destructed.
37 virtual void Uninitialize() {}
38
39 // WebUIMessageHandler implementation.
40 virtual void RegisterMessages() OVERRIDE {}
41
42 // content::NotificationObserver implementation.
43 virtual void Observe(int type,
44 const content::NotificationSource& source,
45 const content::NotificationDetails& details) OVERRIDE {}
46
47 protected:
48 struct OptionsStringResource {
49 // The name of the resource in templateData.
50 const char* name;
51 // The .grd ID for the resource (IDS_*).
52 int id;
53 };
54 // A helper for simplifying the process of registering strings in WebUI.
55 static void RegisterStrings(base::DictionaryValue* localized_strings,
56 const OptionsStringResource* resources,
57 size_t length);
58
59 // Registers string resources for a page's header and tab title.
60 static void RegisterTitle(base::DictionaryValue* localized_strings,
61 const std::string& variable_name,
62 int title_id);
63
64 content::NotificationRegistrar registrar_;
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(OptionsPage2UIHandler);
68 };
69
70 // An interface for common operations that a host of OptionsPage2UIHandlers
71 // should provide.
72 class OptionsPage2UIHandlerHost {
73 public:
74 virtual void InitializeHandlers() = 0;
75
76 protected:
77 virtual ~OptionsPage2UIHandlerHost() {}
78 };
79
80 // The WebUI for chrome:settings-frame.
81 class Options2UI : public ChromeWebUI,
82 public OptionsPage2UIHandlerHost {
83 public:
84 explicit Options2UI(TabContents* contents);
85 virtual ~Options2UI();
86
87 static RefCountedMemory* GetFaviconResourceBytes();
88
89 // WebUI implementation.
90 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
91 virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE;
92 virtual void DidBecomeActiveForReusedRenderView() OVERRIDE;
93
94 // Overridden from OptionsPage2UIHandlerHost:
95 virtual void InitializeHandlers() OVERRIDE;
96
97 private:
98 // Adds OptionsPageUiHandler to the handlers list if handler is enabled.
99 void AddOptionsPageUIHandler(base::DictionaryValue* localized_strings,
100 OptionsPage2UIHandler* handler);
101
102 // Sets the WebUI CommandLineString property with arguments passed while
103 // launching chrome.
104 void SetCommandLineString(RenderViewHost* render_view_host);
105
106 bool initialized_handlers_;
107
108 DISALLOW_COPY_AND_ASSIGN(Options2UI);
109 };
110
111 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_OPTIONS_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/options_sync_setup_handler.cc ('k') | chrome/browser/ui/webui/options2/options_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698