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

Side by Side Diff: chrome/browser/ui/webui/edit_search_engine_dialog_webui.h

Issue 8118012: WebUI Edit Search Engine Dialog (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: changed webui class names as per precedent Created 9 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 | 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_EDIT_SEARCH_ENGINE_DIALOG_WEBUI_H_
6 #define CHROME_BROWSER_UI_WEBUI_EDIT_SEARCH_ENGINE_DIALOG_WEBUI_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/webui/html_dialog_ui.h"
14
15 class EditSearchEngineController;
16 class Profile;
17 class TemplateURL;
18 class EditSearchEngineDialogHandlerWebUI;
19
20 // EditSearchEngineDialogWebUI is the WebUI HTML dialog version of the edit
21 // search engine dialog.
22 class EditSearchEngineDialogWebUI : private HtmlDialogUIDelegate {
23 public:
24 static void ShowEditSearchEngineDialog(const TemplateURL* template_url,
25 Profile* profile);
26
27 private:
28 explicit EditSearchEngineDialogWebUI(
29 EditSearchEngineDialogHandlerWebUI* handler);
30
31 // Shows the dialog
32 void ShowDialog();
33
34 // HtmlDialogUIDelegate methods
35 virtual bool IsDialogModal() const OVERRIDE;
36 virtual string16 GetDialogTitle() const OVERRIDE;
37 virtual GURL GetDialogContentURL() const OVERRIDE;
38 virtual void GetWebUIMessageHandlers(
39 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE;
40 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
41 virtual std::string GetDialogArgs() const OVERRIDE;
42 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
43 virtual void OnCloseContents(TabContents* source,
44 bool* out_close_dialog) OVERRIDE;
45 virtual bool ShouldShowDialogTitle() const OVERRIDE;
46
47 // The message handler for this dialog.
48 EditSearchEngineDialogHandlerWebUI* handler_;
49
50 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialogWebUI);
51 };
52
53 // EditSearchEngineDialogHandlerWebUI is the message handling component of the
54 // EditSearchEngineDialogWebUI. It handles messages from JavaScript, and it
55 // handles the closing of the dialog.
56 class EditSearchEngineDialogHandlerWebUI : public WebUIMessageHandler {
57 public:
58 EditSearchEngineDialogHandlerWebUI(const TemplateURL* template_url,
59 Profile* profile);
60 virtual ~EditSearchEngineDialogHandlerWebUI();
61
62 // Overridden from WebUIMessageHandler
63 virtual void RegisterMessages() OVERRIDE;
64
65 // Returns true if adding, and false if editing, based on the template_url.
66 bool IsAdding();
67
68 // Although it's not really a message, the closing of the dialog is relevant
69 // to the handler.
70 void OnDialogClosed(const std::string& json_retval);
71
72 private:
73 void RequestDetails(const base::ListValue* args);
74 void RequestValidation(const base::ListValue* args);
75
76 // The template url.
77 const TemplateURL* template_url_;
78
79 // The profile.
80 Profile* profile_;
81
82 // The controller.
83 scoped_ptr<EditSearchEngineController> controller_;
84
85 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialogHandlerWebUI);
86 };
87
88 #endif // CHROME_BROWSER_UI_WEBUI_EDIT_SEARCH_ENGINE_DIALOG_WEBUI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698