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