OLD | NEW |
---|---|
(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_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_EDIT_SEARCH_ENGINE_DIALOG_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 WebUIEditSearchEngineDialogHandler; | |
19 | |
20 class WebUIEditSearchEngineDialog : private HtmlDialogUIDelegate { | |
21 public: | |
22 static void ShowEditSearchEngineDialog(const TemplateURL* template_url, | |
23 Profile* profile); | |
24 | |
25 private: | |
26 explicit WebUIEditSearchEngineDialog( | |
27 WebUIEditSearchEngineDialogHandler* handler); | |
28 | |
29 // Shows the dialog | |
30 void ShowDialog(); | |
31 | |
32 // HtmlDialogUIDelegate methods | |
33 virtual bool IsDialogModal() const OVERRIDE; | |
34 virtual string16 GetDialogTitle() const OVERRIDE; | |
35 virtual GURL GetDialogContentURL() const OVERRIDE; | |
36 virtual void GetWebUIMessageHandlers( | |
37 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | |
38 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | |
39 virtual std::string GetDialogArgs() const OVERRIDE; | |
40 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | |
41 virtual void OnCloseContents(TabContents* source, | |
42 bool* out_close_dialog) OVERRIDE; | |
43 virtual bool ShouldShowDialogTitle() const OVERRIDE; | |
44 | |
45 // The message handler for this dialog. | |
46 WebUIEditSearchEngineDialogHandler* handler_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(WebUIEditSearchEngineDialog); | |
49 }; | |
50 | |
51 class WebUIEditSearchEngineDialogHandler : public WebUIMessageHandler { | |
52 public: | |
53 WebUIEditSearchEngineDialogHandler(const TemplateURL* template_url, | |
54 Profile* profile); | |
arv (Not doing code reviews)
2011/10/04 20:55:01
indentation
wyck
2011/10/04 21:57:57
Done.
| |
55 | |
56 // Overridden from WebUIMessageHandler | |
57 virtual void RegisterMessages() OVERRIDE; | |
58 | |
59 // Returns true if adding, and false if editing, based on the template_url. | |
60 bool IsAdding(); | |
61 | |
62 // Although it's not really a message, the closing of the dialog is relevant | |
63 // to the handler. | |
64 void OnDialogClosed(const std::string& json_retval); | |
65 | |
66 private: | |
67 void RequestDetails(const base::ListValue* args); | |
68 | |
69 // The template url. | |
70 const TemplateURL* template_url_; | |
71 | |
72 // The profile. | |
73 Profile* profile_; | |
74 | |
75 // The controller. | |
76 scoped_ptr<EditSearchEngineController> controller_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(WebUIEditSearchEngineDialogHandler); | |
79 }; | |
80 | |
81 #endif // CHROME_BROWSER_UI_WEBUI_EDIT_SEARCH_ENGINE_DIALOG_H_ | |
OLD | NEW |