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/time.h" |
16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
17 #include "base/time.h" | |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/download/download_prefs.h" | 19 #include "chrome/browser/download/download_prefs.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_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
25 #include "chrome/browser/ui/browser_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
27 #include "chrome/browser/ui/singleton_tabs.h" | 27 #include "chrome/browser/ui/singleton_tabs.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 #if defined(OS_CHROMEOS) | 161 #if defined(OS_CHROMEOS) |
162 // For ChromeOS, don't use the browser window but the root window | 162 // For ChromeOS, don't use the browser window but the root window |
163 // instead to grab the screenshot. We want everything on the screen, not | 163 // instead to grab the screenshot. We want everything on the screen, not |
164 // just the current browser. | 164 // just the current browser. |
165 native_window = ash::Shell::GetPrimaryRootWindow(); | 165 native_window = ash::Shell::GetPrimaryRootWindow(); |
166 snapshot_bounds = gfx::Rect(native_window->bounds()); | 166 snapshot_bounds = gfx::Rect(native_window->bounds()); |
167 #else | 167 #else |
168 native_window = browser->window()->GetNativeWindow(); | 168 native_window = browser->window()->GetNativeWindow(); |
169 snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size()); | 169 snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size()); |
170 #endif | 170 #endif |
171 bool success = browser::GrabWindowSnapshot(native_window, | 171 bool success = chrome::GrabWindowSnapshot(native_window, |
172 last_screenshot_png, | 172 last_screenshot_png, |
173 snapshot_bounds); | 173 snapshot_bounds); |
174 FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect()); | 174 FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect()); |
175 | 175 |
176 std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + "?" + | 176 std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + "?" + |
177 kSessionIDParameter + base::IntToString(browser->session_id().id()) + | 177 kSessionIDParameter + base::IntToString(browser->session_id().id()) + |
178 "&" + kTabIndexParameter + base::IntToString(browser->active_index()) + | 178 "&" + kTabIndexParameter + base::IntToString(browser->active_index()) + |
179 "&" + kDescriptionParameter + | 179 "&" + kDescriptionParameter + |
180 net::EscapeUrlEncodedData(description_template, false) + "&" + | 180 net::EscapeUrlEncodedData(description_template, false) + "&" + |
181 kCategoryTagParameter + net::EscapeUrlEncodedData(category_tag, false); | 181 kCategoryTagParameter + net::EscapeUrlEncodedData(category_tag, false); |
182 | 182 |
183 #if defined(OS_CHROMEOS) | 183 #if defined(OS_CHROMEOS) |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 647 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
648 std::partial_sort(screenshot_filepaths.begin(), | 648 std::partial_sort(screenshot_filepaths.begin(), |
649 screenshot_filepaths.begin() + sort_size, | 649 screenshot_filepaths.begin() + sort_size, |
650 screenshot_filepaths.end(), | 650 screenshot_filepaths.end(), |
651 ScreenshotTimestampComp); | 651 ScreenshotTimestampComp); |
652 for (size_t i = 0; i < sort_size; ++i) | 652 for (size_t i = 0; i < sort_size; ++i) |
653 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 653 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
654 screenshot_filepaths[i]); | 654 screenshot_filepaths[i]); |
655 } | 655 } |
656 #endif | 656 #endif |
OLD | NEW |