OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/ui/webui/input_window_dialog_webui.h" | 5 #include "chrome/browser/ui/webui/input_window_dialog_webui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "chrome/browser/ui/dialog_style.h" |
16 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 17 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 const int kInputWindowDialogWidth = 300; | 25 const int kInputWindowDialogWidth = 300; |
25 const int kInputWindowDialogBaseHeight = 90; | 26 const int kInputWindowDialogBaseHeight = 90; |
(...skipping 16 matching lines...) Expand all Loading... |
42 delegate_(delegate), | 43 delegate_(delegate), |
43 type_(type) { | 44 type_(type) { |
44 } | 45 } |
45 | 46 |
46 InputWindowDialogWebUI::~InputWindowDialogWebUI() { | 47 InputWindowDialogWebUI::~InputWindowDialogWebUI() { |
47 } | 48 } |
48 | 49 |
49 void InputWindowDialogWebUI::Show() { | 50 void InputWindowDialogWebUI::Show() { |
50 Browser* browser = BrowserList::GetLastActive(); | 51 Browser* browser = BrowserList::GetLastActive(); |
51 DCHECK(browser); | 52 DCHECK(browser); |
52 browser->BrowserShowHtmlDialog(this, NULL); | 53 browser->BrowserShowHtmlDialog(this, NULL, STYLE_GENERIC); |
53 closed_ = false; | 54 closed_ = false; |
54 } | 55 } |
55 | 56 |
56 void InputWindowDialogWebUI::Close() { | 57 void InputWindowDialogWebUI::Close() { |
57 if (!closed_) { | 58 if (!closed_) { |
58 DCHECK(handler_); | 59 DCHECK(handler_); |
59 handler_->CloseDialog(); | 60 handler_->CloseDialog(); |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 string16 url; | 168 string16 url; |
168 if (args->GetSize() == 2 && args->GetString(0, &url)) { | 169 if (args->GetSize() == 2 && args->GetString(0, &url)) { |
169 texts.push_back(url); | 170 texts.push_back(url); |
170 } | 171 } |
171 const bool valid = delegate_->IsValid(texts); | 172 const bool valid = delegate_->IsValid(texts); |
172 scoped_ptr<Value> result(Value::CreateBooleanValue(valid)); | 173 scoped_ptr<Value> result(Value::CreateBooleanValue(valid)); |
173 web_ui_->CallJavascriptFunction("inputWindowDialog.ackValidation", | 174 web_ui_->CallJavascriptFunction("inputWindowDialog.ackValidation", |
174 *result); | 175 *result); |
175 } | 176 } |
OLD | NEW |