| OLD | NEW |
| 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 "chrome/browser/ui/webui/feedback_ui.h" | 5 #include "chrome/browser/ui/webui/feedback_ui.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/feedback/feedback_data.h" | 17 #include "chrome/browser/feedback/feedback_data.h" |
| 18 #include "chrome/browser/feedback/feedback_util.h" | 18 #include "chrome/browser/feedback/feedback_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 25 #include "chrome/browser/ui/webui/screenshot_source.h" | 25 #include "chrome/browser/ui/webui/screenshot_source.h" |
| 26 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 26 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "content/browser/webui/web_ui.h" |
| 29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/navigation_controller.h" | 31 #include "content/public/browser/navigation_controller.h" |
| 31 #include "content/public/browser/navigation_entry.h" | 32 #include "content/public/browser/navigation_entry.h" |
| 32 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/browser/web_ui_message_handler.h" | 34 #include "content/public/browser/web_ui_message_handler.h" |
| 34 #include "grit/browser_resources.h" | 35 #include "grit/browser_resources.h" |
| 35 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #include "grit/locale_settings.h" | 38 #include "grit/locale_settings.h" |
| 38 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } else { | 523 } else { |
| 523 LOG(FATAL) << "Failed to get last active browser."; | 524 LOG(FATAL) << "Failed to get last active browser."; |
| 524 } | 525 } |
| 525 } | 526 } |
| 526 | 527 |
| 527 //////////////////////////////////////////////////////////////////////////////// | 528 //////////////////////////////////////////////////////////////////////////////// |
| 528 // | 529 // |
| 529 // FeedbackUI | 530 // FeedbackUI |
| 530 // | 531 // |
| 531 //////////////////////////////////////////////////////////////////////////////// | 532 //////////////////////////////////////////////////////////////////////////////// |
| 532 FeedbackUI::FeedbackUI(WebContents* tab) : HtmlDialogUI(tab) { | 533 FeedbackUI::FeedbackUI(WebUI* web_ui) : HtmlDialogUI(web_ui) { |
| 534 WebContents* tab = web_ui->web_contents(); |
| 533 FeedbackHandler* handler = new FeedbackHandler(tab); | 535 FeedbackHandler* handler = new FeedbackHandler(tab); |
| 534 AddMessageHandler(handler); | 536 web_ui->AddMessageHandler(handler); |
| 535 | 537 |
| 536 // The handler's init will determine whether we show the error html page. | 538 // The handler's init will determine whether we show the error html page. |
| 537 ChromeWebUIDataSource* html_source = | 539 ChromeWebUIDataSource* html_source = |
| 538 CreateFeedbackUIHTMLSource(handler->Init()); | 540 CreateFeedbackUIHTMLSource(handler->Init()); |
| 539 | 541 |
| 540 // Set up the chrome://feedback/ source. | 542 // Set up the chrome://feedback/ source. |
| 541 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 543 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 542 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 544 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 543 } | 545 } |
| OLD | NEW |