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/ash/screenshot_taker.h" | 5 #include "chrome/browser/ui/ash/screenshot_taker.h" |
6 | 6 |
7 #include <climits> | 7 #include <climits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 FilePath GetScreenshotPath(const FilePath& base_directory, | 52 FilePath GetScreenshotPath(const FilePath& base_directory, |
53 bool use_24hour_clock) { | 53 bool use_24hour_clock) { |
54 base::Time::Exploded now; | 54 base::Time::Exploded now; |
55 base::Time::Now().LocalExplode(&now); | 55 base::Time::Now().LocalExplode(&now); |
56 | 56 |
57 // We don't use base/i18n/time_formatting.h here because it doesn't | 57 // We don't use base/i18n/time_formatting.h here because it doesn't |
58 // support our format. Don't use ICU either to avoid i18n file names | 58 // support our format. Don't use ICU either to avoid i18n file names |
59 // for non-English locales. | 59 // for non-English locales. |
60 // TODO(mukai): integrate this logic somewhere time_formatting.h | 60 // TODO(mukai): integrate this logic somewhere time_formatting.h |
61 std::string file_name = base::StringPrintf( | 61 std::string file_name = base::StringPrintf( |
62 "Screenshot %d-%02d-%02d ", now.year, now.month, now.day_of_month); | 62 "Screenshot %d-%02d-%02d at ", now.year, now.month, now.day_of_month); |
63 | 63 |
64 if (use_24hour_clock) { | 64 if (use_24hour_clock) { |
65 file_name.append(base::StringPrintf( | 65 file_name.append(base::StringPrintf( |
66 "%02d:%02d:%02d", now.hour, now.minute, now.second)); | 66 "%02d.%02d.%02d", now.hour, now.minute, now.second)); |
67 } else { | 67 } else { |
68 int hour = now.hour; | 68 int hour = now.hour; |
69 if (hour > 12) { | 69 if (hour > 12) { |
70 hour -= 12; | 70 hour -= 12; |
71 } else if (hour == 0) { | 71 } else if (hour == 0) { |
72 hour = 12; | 72 hour = 12; |
73 } | 73 } |
74 file_name.append(base::StringPrintf( | 74 file_name.append(base::StringPrintf( |
75 "%d:%02d:%02d ", hour, now.minute, now.second)); | 75 "%d.%02d.%02d ", hour, now.minute, now.second)); |
76 file_name.append((now.hour >= 12) ? "PM" : "AM"); | 76 file_name.append((now.hour >= 12) ? "PM" : "AM"); |
77 } | 77 } |
78 | 78 |
79 for (int retry = 0; retry < INT_MAX; retry++) { | 79 for (int retry = 0; retry < INT_MAX; retry++) { |
80 std::string retry_suffix; | 80 std::string retry_suffix; |
81 if (retry > 0) | 81 if (retry > 0) |
82 retry_suffix = base::StringPrintf(" (%d)", retry + 1); | 82 retry_suffix = base::StringPrintf(" (%d)", retry + 1); |
83 | 83 |
84 FilePath file_path = base_directory.AppendASCII( | 84 FilePath file_path = base_directory.AppendASCII( |
85 file_name + retry_suffix + ".png"); | 85 file_name + retry_suffix + ".png"); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 ash::internal::kShellWindowId_OverlayContainer)->layer(); | 218 ash::internal::kShellWindowId_OverlayContainer)->layer(); |
219 parent->Add(visual_feedback_layer_.get()); | 219 parent->Add(visual_feedback_layer_.get()); |
220 visual_feedback_layer_->SetVisible(true); | 220 visual_feedback_layer_->SetVisible(true); |
221 | 221 |
222 MessageLoopForUI::current()->PostDelayedTask( | 222 MessageLoopForUI::current()->PostDelayedTask( |
223 FROM_HERE, | 223 FROM_HERE, |
224 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, | 224 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, |
225 base::Unretained(this)), | 225 base::Unretained(this)), |
226 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); | 226 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); |
227 } | 227 } |
OLD | NEW |