Index: chrome/browser/ui/ash/chrome_screenshot_grabber.cc |
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc |
index fff9cd3e48b83ea80a120bb3fed304a49de177f2..20225126af58f941d52c7086453729ae08cc4bcd 100644 |
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc |
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc |
@@ -350,6 +350,29 @@ void ChromeScreenshotGrabber::HandleTakePartialScreenshot( |
content::RecordAction(base::UserMetricsAction("Screenshot_TakePartial")); |
} |
+void ChromeScreenshotGrabber::HandleTakeWindowScreenshot(aura::Window* window) { |
+ if (ScreenshotsDisabled()) { |
+ screenshot_grabber_->NotifyScreenshotCompleted( |
+ ui::ScreenshotGrabberObserver::SCREENSHOTS_DISABLED, base::FilePath()); |
+ return; |
+ } |
+ |
+ base::FilePath screenshot_directory; |
+ if (!GetScreenshotDirectory(&screenshot_directory)) { |
+ screenshot_grabber_->NotifyScreenshotCompleted( |
+ ui::ScreenshotGrabberObserver::SCREENSHOT_GET_DIR_FAILED, |
+ base::FilePath()); |
+ return; |
+ } |
+ |
+ base::FilePath screenshot_path = |
+ screenshot_directory.AppendASCII(GetScreenshotBaseFilename() + ".png"); |
+ aura::Window* root_window = window->GetRootWindow(); |
+ gfx::Rect root_rect = root_window->bounds(); |
sky
2016/03/25 15:27:53
This code assumes window is a direct child of root
Qiang(Joe) Xu
2016/03/25 19:09:40
GetRootWindow() will get root window, it is not pa
sky
2016/03/25 20:37:08
GetRootWindow() walks up the tree starting at wind
|
+ screenshot_grabber_->TakeScreenshot(window, root_rect, screenshot_path); |
sky
2016/03/25 15:27:53
I'm confused by the coordinates here. You're passi
Qiang(Joe) Xu
2016/03/25 19:09:40
Here we should use the root window's coordinates a
sky
2016/03/25 20:37:08
This is the comment says for the function you're u
Qiang(Joe) Xu
2016/03/25 21:15:54
I get it:
My original one is: passing active_windo
sky
2016/03/25 22:58:43
I don't think that's right either. The problem wit
|
+ content::RecordAction(base::UserMetricsAction("Screenshot_TakeWindow")); |
+} |
+ |
bool ChromeScreenshotGrabber::CanTakeScreenshot() { |
return screenshot_grabber_->CanTakeScreenshot(); |
} |