| 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/repost_form_warning_ui.h" | 5 #include "chrome/browser/ui/webui/repost_form_warning_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/repost_form_warning_controller.h" | 15 #include "chrome/browser/repost_form_warning_controller.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 17 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 18 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 18 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 19 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 19 #include "chrome/common/jstemplate_builder.h" | 20 #include "chrome/common/jstemplate_builder.h" |
| 20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
| 22 #include "grit/browser_resources.h" | 23 #include "grit/browser_resources.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 static const int kDialogHeight = 108; | 134 static const int kDialogHeight = 108; |
| 134 | 135 |
| 135 RepostFormWarningUI* ui_; // not owned | 136 RepostFormWarningUI* ui_; // not owned |
| 136 | 137 |
| 137 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningHtmlDelegate); | 138 DISALLOW_COPY_AND_ASSIGN(RepostFormWarningHtmlDelegate); |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 RepostFormWarningUI::RepostFormWarningUI(gfx::NativeWindow parent_window, | 141 RepostFormWarningUI::RepostFormWarningUI(gfx::NativeWindow parent_window, |
| 141 TabContents* tab_contents) | 142 TabContents* tab_contents) |
| 142 : controller_(new RepostFormWarningController(tab_contents)) { | 143 : controller_(new RepostFormWarningController(tab_contents)) { |
| 143 Profile* profile = | 144 TabContentsWrapper* wrapper = |
| 144 Profile::FromBrowserContext(tab_contents->browser_context()); | 145 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 146 Profile* profile = wrapper->profile(); |
| 145 RepostFormWarningSource::RegisterDataSource(profile); | 147 RepostFormWarningSource::RegisterDataSource(profile); |
| 146 RepostFormWarningHtmlDelegate* delegate = | 148 RepostFormWarningHtmlDelegate* delegate = |
| 147 new RepostFormWarningHtmlDelegate(this); | 149 new RepostFormWarningHtmlDelegate(this); |
| 148 ConstrainedHtmlUI::CreateConstrainedHtmlDialog( | 150 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile, delegate, wrapper); |
| 149 profile, delegate, tab_contents); | |
| 150 } | 151 } |
| 151 | 152 |
| 152 RepostFormWarningUI::~RepostFormWarningUI() {} | 153 RepostFormWarningUI::~RepostFormWarningUI() {} |
| 153 | 154 |
| 154 void RepostFormWarningUI::OnDialogClosed(bool repost) { | 155 void RepostFormWarningUI::OnDialogClosed(bool repost) { |
| 155 if (repost) | 156 if (repost) |
| 156 controller_->Continue(); | 157 controller_->Continue(); |
| 157 else | 158 else |
| 158 controller_->Cancel(); | 159 controller_->Cancel(); |
| 159 delete this; | 160 delete this; |
| 160 } | 161 } |
| OLD | NEW |