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

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

Issue 10806056: Move plugin_browsertests.cc from browser_tests to content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to mac+win fixes Created 8 years, 5 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_creator.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"
(...skipping 26 matching lines...) Expand all
37 printf("CONFIRM: %s\n", UTF16ToUTF8(message_text).c_str()); 37 printf("CONFIRM: %s\n", UTF16ToUTF8(message_text).c_str());
38 } else { // JAVASCRIPT_MESSAGE_TYPE_PROMPT 38 } else { // JAVASCRIPT_MESSAGE_TYPE_PROMPT
39 printf("PROMPT: %s, default text: %s\n", 39 printf("PROMPT: %s, default text: %s\n",
40 UTF16ToUTF8(message_text).c_str(), 40 UTF16ToUTF8(message_text).c_str(),
41 UTF16ToUTF8(default_prompt_text).c_str()); 41 UTF16ToUTF8(default_prompt_text).c_str());
42 } 42 }
43 callback.Run(true, string16()); 43 callback.Run(true, string16());
44 return; 44 return;
45 } 45 }
46 46
47 if (!dialog_request_callback_.is_null()) {
48 dialog_request_callback_.Run();
49 callback.Run(true, string16());
50 dialog_request_callback_.Reset();
51 return;
52 }
53
47 #if defined(OS_MACOSX) || defined(OS_WIN) 54 #if defined(OS_MACOSX) || defined(OS_WIN)
48 *did_suppress_message = false; 55 *did_suppress_message = false;
49 56
50 if (dialog_.get()) { 57 if (dialog_.get()) {
51 // One dialog at a time, please. 58 // One dialog at a time, please.
52 *did_suppress_message = true; 59 *did_suppress_message = true;
53 return; 60 return;
54 } 61 }
55 62
56 string16 new_message_text = net::FormatUrl(origin_url, accept_lang) + 63 string16 new_message_text = net::FormatUrl(origin_url, accept_lang) +
(...skipping 21 matching lines...) Expand all
78 printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str()); 85 printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str());
79 LayoutTestControllerHost* controller = 86 LayoutTestControllerHost* controller =
80 LayoutTestControllerHost::FromRenderViewHost( 87 LayoutTestControllerHost::FromRenderViewHost(
81 web_contents->GetRenderViewHost()); 88 web_contents->GetRenderViewHost());
82 callback.Run( 89 callback.Run(
83 !controller->should_stay_on_page_after_handling_before_unload(), 90 !controller->should_stay_on_page_after_handling_before_unload(),
84 string16()); 91 string16());
85 return; 92 return;
86 } 93 }
87 94
95 if (!dialog_request_callback_.is_null()) {
96 dialog_request_callback_.Run();
97 callback.Run(true, string16());
98 dialog_request_callback_.Reset();
99 return;
100 }
101
88 #if defined(OS_MACOSX) || defined(OS_WIN) 102 #if defined(OS_MACOSX) || defined(OS_WIN)
89 if (dialog_.get()) { 103 if (dialog_.get()) {
90 // Seriously!? 104 // Seriously!?
91 callback.Run(true, string16()); 105 callback.Run(true, string16());
92 return; 106 return;
93 } 107 }
94 108
95 string16 new_message_text = 109 string16 new_message_text =
96 message_text + 110 message_text +
97 ASCIIToUTF16("\n\nIs it OK to leave/reload this page?"); 111 ASCIIToUTF16("\n\nIs it OK to leave/reload this page?");
(...skipping 25 matching lines...) Expand all
123 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) { 137 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) {
124 #if defined(OS_MACOSX) || defined(OS_WIN) 138 #if defined(OS_MACOSX) || defined(OS_WIN)
125 DCHECK_EQ(dialog, dialog_.get()); 139 DCHECK_EQ(dialog, dialog_.get());
126 dialog_.reset(); 140 dialog_.reset();
127 #else 141 #else
128 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 142 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
129 #endif 143 #endif
130 } 144 }
131 145
132 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698