| 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/edit_search_engine_dialog_webui.h" | 5 #include "chrome/browser/ui/webui/edit_search_engine_dialog_webui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "chrome/browser/search_engines/template_url.h" | 14 #include "chrome/browser/search_engines/template_url.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/browser/ui/dialog_style.h" |
| 17 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" | 18 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" |
| 18 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 19 #include "grit/ui_resources.h" | 20 #include "grit/ui_resources.h" |
| 20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 const int kEditSearchEngineDialogWidth = 394; | 26 const int kEditSearchEngineDialogWidth = 394; |
| 26 const int kEditSearchEngineDialogHeight = 180; | 27 const int kEditSearchEngineDialogHeight = 180; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 49 } | 50 } |
| 50 | 51 |
| 51 EditSearchEngineDialogWebUI::EditSearchEngineDialogWebUI( | 52 EditSearchEngineDialogWebUI::EditSearchEngineDialogWebUI( |
| 52 EditSearchEngineDialogHandlerWebUI* handler) | 53 EditSearchEngineDialogHandlerWebUI* handler) |
| 53 : handler_(handler) { | 54 : handler_(handler) { |
| 54 } | 55 } |
| 55 | 56 |
| 56 void EditSearchEngineDialogWebUI::ShowDialog() { | 57 void EditSearchEngineDialogWebUI::ShowDialog() { |
| 57 Browser* browser = BrowserList::GetLastActive(); | 58 Browser* browser = BrowserList::GetLastActive(); |
| 58 DCHECK(browser); | 59 DCHECK(browser); |
| 59 browser->BrowserShowHtmlDialog(this, NULL); | 60 browser->BrowserShowHtmlDialog(this, NULL, STYLE_GENERIC); |
| 60 } | 61 } |
| 61 | 62 |
| 62 // HtmlDialogUIDelegate methods | 63 // HtmlDialogUIDelegate methods |
| 63 bool EditSearchEngineDialogWebUI::IsDialogModal() const { | 64 bool EditSearchEngineDialogWebUI::IsDialogModal() const { |
| 64 return true; | 65 return true; |
| 65 } | 66 } |
| 66 | 67 |
| 67 string16 EditSearchEngineDialogWebUI::GetDialogTitle() const { | 68 string16 EditSearchEngineDialogWebUI::GetDialogTitle() const { |
| 68 return l10n_util::GetStringUTF16(handler_->IsAdding() ? | 69 return l10n_util::GetStringUTF16(handler_->IsAdding() ? |
| 69 IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE : | 70 IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE : |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 dict->GetString("keyword", &keyword_str) && | 180 dict->GetString("keyword", &keyword_str) && |
| 180 dict->GetString("url", &url_str)) { | 181 dict->GetString("url", &url_str)) { |
| 181 controller_->AcceptAddOrEdit(description_str, | 182 controller_->AcceptAddOrEdit(description_str, |
| 182 keyword_str, | 183 keyword_str, |
| 183 url_str); | 184 url_str); |
| 184 } else { | 185 } else { |
| 185 controller_->CleanUpCancelledAdd(); | 186 controller_->CleanUpCancelledAdd(); |
| 186 } | 187 } |
| 187 } | 188 } |
| 188 } | 189 } |
| OLD | NEW |