| 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" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 return -1; | 128 return -1; |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 | 133 |
| 134 namespace browser { | 134 namespace browser { |
| 135 | 135 |
| 136 void ShowHtmlFeedbackView(Browser* browser, | 136 void ShowWebFeedbackView(Browser* browser, |
| 137 const std::string& description_template, | 137 const std::string& description_template, |
| 138 const std::string& category_tag) { | 138 const std::string& category_tag) { |
| 139 #if defined(OS_CHROMEOS) | 139 #if defined(OS_CHROMEOS) |
| 140 // Grab the timestamp before we do anything else - this is crucial to help | 140 // Grab the timestamp before we do anything else - this is crucial to help |
| 141 // diagnose some hardware issues. | 141 // diagnose some hardware issues. |
| 142 base::Time now = base::Time::Now(); | 142 base::Time now = base::Time::Now(); |
| 143 std::string timestamp = base::DoubleToString(now.ToDoubleT()); | 143 std::string timestamp = base::DoubleToString(now.ToDoubleT()); |
| 144 #endif | 144 #endif |
| 145 | 145 |
| 146 // First check if we're already open (we cannot depend on ShowSingletonTab | 146 // First check if we're already open (we cannot depend on ShowSingletonTab |
| 147 // for this functionality since we need to make *sure* we never get | 147 // for this functionality since we need to make *sure* we never get |
| 148 // instantiated again while we are open - with singleton tabs, that can | 148 // instantiated again while we are open - with singleton tabs, that can |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 } else { | 569 } else { |
| 570 LOG(FATAL) << "Failed to get last active browser."; | 570 LOG(FATAL) << "Failed to get last active browser."; |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 //////////////////////////////////////////////////////////////////////////////// | 574 //////////////////////////////////////////////////////////////////////////////// |
| 575 // | 575 // |
| 576 // FeedbackUI | 576 // FeedbackUI |
| 577 // | 577 // |
| 578 //////////////////////////////////////////////////////////////////////////////// | 578 //////////////////////////////////////////////////////////////////////////////// |
| 579 FeedbackUI::FeedbackUI(content::WebUI* web_ui) : HtmlDialogUI(web_ui) { | 579 FeedbackUI::FeedbackUI(content::WebUI* web_ui) |
| 580 : WebDialogUI(web_ui) { |
| 580 FeedbackHandler* handler = new FeedbackHandler(web_ui->GetWebContents()); | 581 FeedbackHandler* handler = new FeedbackHandler(web_ui->GetWebContents()); |
| 581 web_ui->AddMessageHandler(handler); | 582 web_ui->AddMessageHandler(handler); |
| 582 | 583 |
| 583 // The handler's init will determine whether we show the error html page. | 584 // The handler's init will determine whether we show the error html page. |
| 584 ChromeWebUIDataSource* html_source = | 585 ChromeWebUIDataSource* html_source = |
| 585 CreateFeedbackUIHTMLSource(handler->Init()); | 586 CreateFeedbackUIHTMLSource(handler->Init()); |
| 586 | 587 |
| 587 // Set up the chrome://feedback/ source. | 588 // Set up the chrome://feedback/ source. |
| 588 Profile* profile = Profile::FromWebUI(web_ui); | 589 Profile* profile = Profile::FromWebUI(web_ui); |
| 589 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 590 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 609 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 610 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
| 610 std::partial_sort(screenshot_filepaths.begin(), | 611 std::partial_sort(screenshot_filepaths.begin(), |
| 611 screenshot_filepaths.begin() + sort_size, | 612 screenshot_filepaths.begin() + sort_size, |
| 612 screenshot_filepaths.end(), | 613 screenshot_filepaths.end(), |
| 613 ScreenshotTimestampComp); | 614 ScreenshotTimestampComp); |
| 614 for (size_t i = 0; i < sort_size; ++i) | 615 for (size_t i = 0; i < sort_size; ++i) |
| 615 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 616 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
| 616 screenshot_filepaths[i]); | 617 screenshot_filepaths[i]); |
| 617 } | 618 } |
| 618 #endif | 619 #endif |
| OLD | NEW |