| 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/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/download/download_util.h" | 19 #include "chrome/browser/download/download_util.h" |
| 20 #include "chrome/browser/feedback/feedback_data.h" | 20 #include "chrome/browser/feedback/feedback_data.h" |
| 21 #include "chrome/browser/feedback/feedback_util.h" | 21 #include "chrome/browser/feedback/feedback_util.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 27 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 27 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 28 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 28 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 29 #include "chrome/browser/ui/webui/screenshot_source.h" | 29 #include "chrome/browser/ui/webui/screenshot_source.h" |
| 30 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | 30 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/navigation_controller.h" | 34 #include "content/public/browser/navigation_controller.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 ReplaceFirstSubstringAfterOffset(×tamp_, | 351 ReplaceFirstSubstringAfterOffset(×tamp_, |
| 352 0, | 352 0, |
| 353 kTimestampParameter, | 353 kTimestampParameter, |
| 354 ""); | 354 ""); |
| 355 break; | 355 break; |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 #endif | 359 #endif |
| 360 | 360 |
| 361 // TODO(beng): Replace GetLastActive with a more specific method of locating | 361 Browser* browser = |
| 362 // the target contents. | 362 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
| 363 Browser* browser = BrowserList::GetLastActive(); | |
| 364 // Sanity checks. | 363 // Sanity checks. |
| 365 if (((index == 0) && (index_str != "0")) || !browser || | 364 if (((index == 0) && (index_str != "0")) || !browser || |
| 366 index >= browser->tab_count()) { | 365 index >= browser->tab_count()) { |
| 367 return false; | 366 return false; |
| 368 } | 367 } |
| 369 | 368 |
| 370 WebContents* target_tab = browser->GetWebContentsAt(index); | 369 WebContents* target_tab = browser->GetWebContentsAt(index); |
| 371 if (target_tab) { | 370 if (target_tab) { |
| 372 target_tab_url_ = target_tab->GetURL().spec(); | 371 target_tab_url_ = target_tab->GetURL().spec(); |
| 373 } | 372 } |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 613 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
| 615 std::partial_sort(screenshot_filepaths.begin(), | 614 std::partial_sort(screenshot_filepaths.begin(), |
| 616 screenshot_filepaths.begin() + sort_size, | 615 screenshot_filepaths.begin() + sort_size, |
| 617 screenshot_filepaths.end(), | 616 screenshot_filepaths.end(), |
| 618 ScreenshotTimestampComp); | 617 ScreenshotTimestampComp); |
| 619 for (size_t i = 0; i < sort_size; ++i) | 618 for (size_t i = 0; i < sort_size; ++i) |
| 620 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 619 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
| 621 screenshot_filepaths[i]); | 620 screenshot_filepaths[i]); |
| 622 } | 621 } |
| 623 #endif | 622 #endif |
| OLD | NEW |