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

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

Issue 10451047: content: Move javascript_message_type.h into content/ from ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/shell/shell_javascript_dialog.h" 9 #include "content/shell/shell_javascript_dialog.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 ShellJavaScriptDialogCreator::ShellJavaScriptDialogCreator() { 14 ShellJavaScriptDialogCreator::ShellJavaScriptDialogCreator() {
15 } 15 }
16 16
17 ShellJavaScriptDialogCreator::~ShellJavaScriptDialogCreator() { 17 ShellJavaScriptDialogCreator::~ShellJavaScriptDialogCreator() {
18 } 18 }
19 19
20 void ShellJavaScriptDialogCreator::RunJavaScriptDialog( 20 void ShellJavaScriptDialogCreator::RunJavaScriptDialog(
21 WebContents* web_contents, 21 WebContents* web_contents,
22 const GURL& origin_url, 22 const GURL& origin_url,
23 const std::string& accept_lang, 23 const std::string& accept_lang,
24 ui::JavascriptMessageType javascript_message_type, 24 JavaScriptMessageType javascript_message_type,
25 const string16& message_text, 25 const string16& message_text,
26 const string16& default_prompt_text, 26 const string16& default_prompt_text,
27 const DialogClosedCallback& callback, 27 const DialogClosedCallback& callback,
28 bool* did_suppress_message) { 28 bool* did_suppress_message) {
29 #if defined(OS_MACOSX) || defined(OS_WIN) 29 #if defined(OS_MACOSX) || defined(OS_WIN)
30 *did_suppress_message = false; 30 *did_suppress_message = false;
31 31
32 if (dialog_.get()) { 32 if (dialog_.get()) {
33 // One dialog at a time, please. 33 // One dialog at a time, please.
34 *did_suppress_message = true; 34 *did_suppress_message = true;
(...skipping 26 matching lines...) Expand all
61 // Seriously!? 61 // Seriously!?
62 callback.Run(true, string16()); 62 callback.Run(true, string16());
63 return; 63 return;
64 } 64 }
65 65
66 string16 new_message_text = 66 string16 new_message_text =
67 message_text + 67 message_text +
68 ASCIIToUTF16("\n\nIs it OK to leave/reload this page?"); 68 ASCIIToUTF16("\n\nIs it OK to leave/reload this page?");
69 69
70 dialog_.reset(new ShellJavaScriptDialog(this, 70 dialog_.reset(new ShellJavaScriptDialog(this,
71 ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, 71 JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
72 new_message_text, 72 new_message_text,
73 string16(), // default_prompt_text 73 string16(), // default_prompt_text
74 callback)); 74 callback));
75 #else 75 #else
76 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 76 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
77 callback.Run(true, string16()); 77 callback.Run(true, string16());
78 return; 78 return;
79 #endif 79 #endif
80 } 80 }
81 81
(...skipping 12 matching lines...) Expand all
94 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) { 94 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) {
95 #if defined(OS_MACOSX) || defined(OS_WIN) 95 #if defined(OS_MACOSX) || defined(OS_WIN)
96 DCHECK_EQ(dialog, dialog_.get()); 96 DCHECK_EQ(dialog, dialog_.get());
97 dialog_.reset(); 97 dialog_.reset();
98 #else 98 #else
99 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 99 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
100 #endif 100 #endif
101 } 101 }
102 102
103 } // namespace content 103 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698