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

Side by Side Diff: components/app_modal/javascript_dialog_manager_impl.h

Issue 688853005: Consolidate javascript_dialog_manager.h and javascript_dialog_manager_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright 2014 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 COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_IMPL_H_
6 #define COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_IMPL_H_
7
8 #include "content/public/browser/javascript_dialog_manager.h"
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h"
12 #include "components/app_modal/javascript_app_modal_dialog.h"
13
14 class JavaScriptDialogExtensionsClient;
15 class JavaScriptNativeDialogFactory;
16
17 class JavaScriptDialogManagerImpl : public content::JavaScriptDialogManager {
18 public:
19 static JavaScriptDialogManagerImpl* GetInstance();
20
21 // JavaScriptDialogManager:
22 void RunJavaScriptDialog(content::WebContents* web_contents,
23 const GURL& origin_url,
24 const std::string& accept_lang,
25 content::JavaScriptMessageType message_type,
26 const base::string16& message_text,
27 const base::string16& default_prompt_text,
28 const DialogClosedCallback& callback,
29 bool* did_suppress_message) override;
30 void RunBeforeUnloadDialog(content::WebContents* web_contents,
31 const base::string16& message_text,
32 bool is_reload,
33 const DialogClosedCallback& callback) override;
34 bool HandleJavaScriptDialog(content::WebContents* web_contents,
35 bool accept,
36 const base::string16* prompt_override) override;
37 void CancelActiveAndPendingDialogs(
38 content::WebContents* web_contents) override;
39 void WebContentsDestroyed(content::WebContents* web_contents) override;
40
41 JavaScriptNativeDialogFactory* native_dialog_factory() {
42 return native_dialog_factory_.get();
43 }
44
45 void SetNativeDialogFactory(
46 scoped_ptr<JavaScriptNativeDialogFactory> factory);
47
48 void SetExtensionsClient(
49 scoped_ptr<JavaScriptDialogExtensionsClient> extensions_client);
50
51 private:
52 friend struct DefaultSingletonTraits<JavaScriptDialogManagerImpl>;
53
54 JavaScriptDialogManagerImpl();
55 ~JavaScriptDialogManagerImpl() override;
56
57 base::string16 GetTitle(content::WebContents* web_contents,
58 const GURL& origin_url,
59 const std::string& accept_lang,
60 bool is_alert);
61
62 // Wrapper around a DialogClosedCallback so that we can intercept it before
63 // passing it onto the original callback.
64 void OnDialogClosed(content::WebContents* web_contents,
65 DialogClosedCallback callback,
66 bool success,
67 const base::string16& user_input);
68
69 // Mapping between the WebContents and their extra data. The key
70 // is a void* because the pointer is just a cookie and is never dereferenced.
71 JavaScriptAppModalDialog::ExtraDataMap javascript_dialog_extra_data_;
72
73 scoped_ptr<JavaScriptDialogExtensionsClient> extensions_client_;
74 scoped_ptr<JavaScriptNativeDialogFactory> native_dialog_factory_;
75
76 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogManagerImpl);
77 };
78
79 #endif // COMPONENTS_APP_MODAL_JAVASCRIPT_DIALOG_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « components/app_modal/javascript_dialog_manager.cc ('k') | components/app_modal/javascript_dialog_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698