| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 gfx::NativeWindow native_window; | 150 gfx::NativeWindow native_window; |
| 151 gfx::Rect snapshot_bounds; | 151 gfx::Rect snapshot_bounds; |
| 152 | 152 |
| 153 #if defined(OS_CHROMEOS) | 153 #if defined(OS_CHROMEOS) |
| 154 // For ChromeOS, don't use the browser window but the root window | 154 // For ChromeOS, don't use the browser window but the root window |
| 155 // instead to grab the screenshot. We want everything on the screen, not | 155 // instead to grab the screenshot. We want everything on the screen, not |
| 156 // just the current browser. | 156 // just the current browser. |
| 157 native_window = ash::Shell::GetPrimaryRootWindow(); | 157 native_window = ash::Shell::GetPrimaryRootWindow(); |
| 158 snapshot_bounds = gfx::Rect(native_window->bounds()); | 158 snapshot_bounds = gfx::Rect(native_window->bounds()); |
| 159 #else | 159 #else |
| 160 native_window = browser->window()->GetNativeHandle(); | 160 native_window = browser->window()->GetNativeWindow(); |
| 161 snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size()); | 161 snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size()); |
| 162 #endif | 162 #endif |
| 163 bool success = browser::GrabWindowSnapshot(native_window, | 163 bool success = browser::GrabWindowSnapshot(native_window, |
| 164 last_screenshot_png, | 164 last_screenshot_png, |
| 165 snapshot_bounds); | 165 snapshot_bounds); |
| 166 FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect()); | 166 FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect()); |
| 167 | 167 |
| 168 std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + | 168 std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + |
| 169 "#" + base::IntToString(browser->active_index()) + "?" + | 169 "#" + base::IntToString(browser->active_index()) + "?" + |
| 170 kDescriptionParameter + | 170 kDescriptionParameter + |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 615 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
| 616 std::partial_sort(screenshot_filepaths.begin(), | 616 std::partial_sort(screenshot_filepaths.begin(), |
| 617 screenshot_filepaths.begin() + sort_size, | 617 screenshot_filepaths.begin() + sort_size, |
| 618 screenshot_filepaths.end(), | 618 screenshot_filepaths.end(), |
| 619 ScreenshotTimestampComp); | 619 ScreenshotTimestampComp); |
| 620 for (size_t i = 0; i < sort_size; ++i) | 620 for (size_t i = 0; i < sort_size; ++i) |
| 621 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 621 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
| 622 screenshot_filepaths[i]); | 622 screenshot_filepaths[i]); |
| 623 } | 623 } |
| 624 #endif | 624 #endif |
| OLD | NEW |