Commit b0cc8a6d authored by Xiaoqian Dai's avatar Xiaoqian Dai Committed by Commit Bot

Capture mode: fullscreen capture consistency.

- Change the fullscreen string to be consistent in image capture and
video capture scenarios
- Click/Tap anywhere can start fullscreen capture

TODO:
- cursor change will be done in a following up cl.

Bug: 1142937
Change-Id: Ife37530245cbc48f8c75be0756d4d45157aac874
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536081Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827181}
parent d649d8d5
...@@ -3115,6 +3115,12 @@ Here are some things you can try to get started. ...@@ -3115,6 +3115,12 @@ Here are some things you can try to get started.
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_TABLET" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in tablet mode."> <message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_TABLET" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in tablet mode.">
Tap anywhere to capture full screen Tap anywhere to capture full screen
</message> </message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_VIDEO_RECORD_CLAMSHELL" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in clamshell mode.">
Click anywhere to record full screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_VIDEO_RECORD_TABLET" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in tablet mode.">
Tap anywhere to record full screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_REGION_IMAGE_CAPTURE" desc="The caputre label message which shows in the middle of the screen when in region image capture mode."> <message name="IDS_ASH_SCREEN_CAPTURE_LABEL_REGION_IMAGE_CAPTURE" desc="The caputre label message which shows in the middle of the screen when in region image capture mode.">
Drag to select an area to capture Drag to select an area to capture
</message> </message>
......
bed4b23cb2a59383349576dcc4fecf61675dcaf2
\ No newline at end of file
ad97137204ac48e4c52fde2278eec258be20c9f3
\ No newline at end of file
...@@ -187,15 +187,14 @@ void CaptureLabelView::UpdateIconAndText() { ...@@ -187,15 +187,14 @@ void CaptureLabelView::UpdateIconAndText() {
base::string16 text; base::string16 text;
switch (source) { switch (source) {
case CaptureModeSource::kFullscreen: case CaptureModeSource::kFullscreen:
icon = is_capturing_image
? gfx::ImageSkia()
: gfx::CreateVectorIcon(kCaptureModeVideoIcon, icon_color);
text = l10n_util::GetStringUTF16( text = l10n_util::GetStringUTF16(
is_capturing_image is_capturing_image
? (in_tablet_mode ? (in_tablet_mode
? IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_TABLET ? IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_TABLET
: IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_CLAMSHELL) : IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_CLAMSHELL)
: IDS_ASH_SCREEN_CAPTURE_LABEL_VIDEO_RECORD); : (in_tablet_mode
? IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_VIDEO_RECORD_TABLET
: IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_VIDEO_RECORD_CLAMSHELL));
break; break;
case CaptureModeSource::kWindow: { case CaptureModeSource::kWindow: {
if (in_tablet_mode) { if (in_tablet_mode) {
......
...@@ -553,11 +553,6 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event, ...@@ -553,11 +553,6 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event,
return; return;
} }
// No need to handle events if the current source is kFullscreen.
const CaptureModeSource capture_source = controller_->source();
if (capture_source == CaptureModeSource::kFullscreen)
return;
gfx::Point location = event->location(); gfx::Point location = event->location();
gfx::Point screen_location = event->location(); gfx::Point screen_location = event->location();
aura::Window* event_target = static_cast<aura::Window*>(event->target()); aura::Window* event_target = static_cast<aura::Window*>(event->target());
...@@ -568,7 +563,11 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event, ...@@ -568,7 +563,11 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event,
capture_mode_bar_widget_->GetWindowBoundsInScreen().Contains( capture_mode_bar_widget_->GetWindowBoundsInScreen().Contains(
screen_location); screen_location);
if (capture_source == CaptureModeSource::kWindow) { const CaptureModeSource capture_source = controller_->source();
const bool is_capture_fullscreen =
capture_source == CaptureModeSource::kFullscreen;
const bool is_capture_window = capture_source == CaptureModeSource::kWindow;
if (is_capture_fullscreen || is_capture_window) {
// Do not handle any event located on the capture mode bar. // Do not handle any event located on the capture mode bar.
if (is_event_on_capture_bar) if (is_event_on_capture_bar)
return; return;
...@@ -580,13 +579,15 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event, ...@@ -580,13 +579,15 @@ void CaptureModeSession::OnLocatedEvent(ui::LocatedEvent* event,
case ui::ET_MOUSE_MOVED: case ui::ET_MOUSE_MOVED:
case ui::ET_TOUCH_PRESSED: case ui::ET_TOUCH_PRESSED:
case ui::ET_TOUCH_MOVED: { case ui::ET_TOUCH_MOVED: {
if (is_capture_window) {
capture_window_observer_->UpdateSelectedWindowAtPosition( capture_window_observer_->UpdateSelectedWindowAtPosition(
screen_location); screen_location);
}
break; break;
} }
case ui::ET_MOUSE_RELEASED: case ui::ET_MOUSE_RELEASED:
case ui::ET_TOUCH_RELEASED: case ui::ET_TOUCH_RELEASED:
if (GetSelectedWindow()) if (is_capture_fullscreen || (is_capture_window && GetSelectedWindow()))
controller_->PerformCapture(); controller_->PerformCapture();
break; break;
default: default:
......
...@@ -1460,4 +1460,24 @@ TEST_F(CaptureModeTest, NumberOfCaptureRegionAdjustmentsHistogram) { ...@@ -1460,4 +1460,24 @@ TEST_F(CaptureModeTest, NumberOfCaptureRegionAdjustmentsHistogram) {
histogram_tester.ExpectBucketCount(kTabletHistogram, 0, 1); histogram_tester.ExpectBucketCount(kTabletHistogram, 0, 1);
} }
TEST_F(CaptureModeTest, FullscreenCapture) {
ui::ScopedAnimationDurationScaleMode animatin_scale(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
CaptureModeController* controller = StartCaptureSession(
CaptureModeSource::kFullscreen, CaptureModeType::kImage);
EXPECT_TRUE(controller->IsActive());
// Press anywhere to capture image.
auto* event_generator = GetEventGenerator();
event_generator->ClickLeftButton();
EXPECT_FALSE(controller->IsActive());
controller = StartCaptureSession(CaptureModeSource::kFullscreen,
CaptureModeType::kVideo);
EXPECT_TRUE(controller->IsActive());
// Press anywhere to capture video.
event_generator->ClickLeftButton();
WaitForCountDownToFinish();
EXPECT_FALSE(controller->IsActive());
}
} // namespace ash } // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment