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

Side by Side Diff: content/shell/shell_javascript_dialog_manager.cc

Issue 12082123: Rename JavaScriptDialogCreator to JavaScriptDialogManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/shell/shell_javascript_dialog_creator.h" 5 #include "content/shell/shell_javascript_dialog_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h" 11 #include "content/public/browser/web_contents_view.h"
12 #include "content/shell/shell_javascript_dialog.h" 12 #include "content/shell/shell_javascript_dialog.h"
13 #include "content/shell/shell_switches.h" 13 #include "content/shell/shell_switches.h"
14 #include "content/shell/webkit_test_controller.h" 14 #include "content/shell/webkit_test_controller.h"
15 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 ShellJavaScriptDialogCreator::ShellJavaScriptDialogCreator() { 19 ShellJavaScriptDialogManager::ShellJavaScriptDialogManager() {
20 } 20 }
21 21
22 ShellJavaScriptDialogCreator::~ShellJavaScriptDialogCreator() { 22 ShellJavaScriptDialogManager::~ShellJavaScriptDialogManager() {
23 } 23 }
24 24
25 void ShellJavaScriptDialogCreator::RunJavaScriptDialog( 25 void ShellJavaScriptDialogManager::RunJavaScriptDialog(
26 WebContents* web_contents, 26 WebContents* web_contents,
27 const GURL& origin_url, 27 const GURL& origin_url,
28 const std::string& accept_lang, 28 const std::string& accept_lang,
29 JavaScriptMessageType javascript_message_type, 29 JavaScriptMessageType javascript_message_type,
30 const string16& message_text, 30 const string16& message_text,
31 const string16& default_prompt_text, 31 const string16& default_prompt_text,
32 const DialogClosedCallback& callback, 32 const DialogClosedCallback& callback,
33 bool* did_suppress_message) { 33 bool* did_suppress_message) {
34 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 34 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
35 callback.Run(true, string16()); 35 callback.Run(true, string16());
(...skipping 28 matching lines...) Expand all
64 new_message_text, 64 new_message_text,
65 default_prompt_text, 65 default_prompt_text,
66 callback)); 66 callback));
67 #else 67 #else
68 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 68 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
69 *did_suppress_message = true; 69 *did_suppress_message = true;
70 return; 70 return;
71 #endif 71 #endif
72 } 72 }
73 73
74 void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog( 74 void ShellJavaScriptDialogManager::RunBeforeUnloadDialog(
75 WebContents* web_contents, 75 WebContents* web_contents,
76 const string16& message_text, 76 const string16& message_text,
77 bool is_reload, 77 bool is_reload,
78 const DialogClosedCallback& callback) { 78 const DialogClosedCallback& callback) {
79 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 79 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
80 WebKitTestController* controller = WebKitTestController::Get(); 80 WebKitTestController* controller = WebKitTestController::Get();
81 callback.Run( 81 callback.Run(
82 !controller->should_stay_on_page_after_handling_before_unload(), 82 !controller->should_stay_on_page_after_handling_before_unload(),
83 string16()); 83 string16());
84 return; 84 return;
(...skipping 26 matching lines...) Expand all
111 new_message_text, 111 new_message_text,
112 string16(), // default_prompt_text 112 string16(), // default_prompt_text
113 callback)); 113 callback));
114 #else 114 #else
115 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 115 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
116 callback.Run(true, string16()); 116 callback.Run(true, string16());
117 return; 117 return;
118 #endif 118 #endif
119 } 119 }
120 120
121 void ShellJavaScriptDialogCreator::ResetJavaScriptState( 121 void ShellJavaScriptDialogManager::ResetJavaScriptState(
122 WebContents* web_contents) { 122 WebContents* web_contents) {
123 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK) 123 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
124 if (dialog_.get()) { 124 if (dialog_.get()) {
125 dialog_->Cancel(); 125 dialog_->Cancel();
126 dialog_.reset(); 126 dialog_.reset();
127 } 127 }
128 #else 128 #else
129 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 129 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
130 #endif 130 #endif
131 } 131 }
132 132
133 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) { 133 void ShellJavaScriptDialogManager::DialogClosed(ShellJavaScriptDialog* dialog) {
134 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK) 134 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
135 DCHECK_EQ(dialog, dialog_.get()); 135 DCHECK_EQ(dialog, dialog_.get());
136 dialog_.reset(); 136 dialog_.reset();
137 #else 137 #else
138 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 138 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
139 #endif 139 #endif
140 } 140 }
141 141
142 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_javascript_dialog_manager.h ('k') | content/shell/shell_javascript_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698