Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 322203002: Add an interface to gather text surrounding the selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@surroundings-patch-5
Patch Set: Moved the callback to RenderWidgetHostViewAndroid. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/android/sys_utils.h" 9 #include "base/android/sys_utils.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 InternalSwapCompositorFrame(last_frame_info_->output_surface_id, 426 InternalSwapCompositorFrame(last_frame_info_->output_surface_id,
427 last_frame_info_->frame.Pass()); 427 last_frame_info_->frame.Pass());
428 last_frame_info_.reset(); 428 last_frame_info_.reset();
429 } 429 }
430 430
431 if (!is_showing_ && layer_) 431 if (!is_showing_ && layer_)
432 layer_->SetHideLayerAndSubtree(true); 432 layer_->SetHideLayerAndSubtree(true);
433 } 433 }
434 } 434 }
435 435
436 void RenderWidgetHostViewAndroid::SetTextSurroundingSelectionCallback(
437 const TextSurroundingSelectionCallback& callback) {
438 // Only one outstanding request is allowed at any given time.
439 DCHECK(!callback.is_null());
440 text_surrounding_selection_callback_ = callback;
441 }
442
436 void RenderWidgetHostViewAndroid::OnTextSurroundingSelectionResponse( 443 void RenderWidgetHostViewAndroid::OnTextSurroundingSelectionResponse(
437 const base::string16& content, 444 const base::string16& content,
438 size_t start_offset, 445 size_t start_offset,
439 size_t end_offset) { 446 size_t end_offset) {
447 if (text_surrounding_selection_callback_.is_null())
448 return;
449 text_surrounding_selection_callback_.Run(content, start_offset, end_offset);
450 text_surrounding_selection_callback_.Reset();
440 } 451 }
441 452
442 void RenderWidgetHostViewAndroid::ReleaseLocksOnSurface() { 453 void RenderWidgetHostViewAndroid::ReleaseLocksOnSurface() {
443 if (!frame_evictor_->HasFrame()) { 454 if (!frame_evictor_->HasFrame()) {
444 DCHECK_EQ(locks_on_frame_count_, 0u); 455 DCHECK_EQ(locks_on_frame_count_, 0u);
445 return; 456 return;
446 } 457 }
447 while (locks_on_frame_count_ > 0) { 458 while (locks_on_frame_count_ > 0) {
448 UnlockCompositingSurface(); 459 UnlockCompositingSurface();
449 } 460 }
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 results->availableRect = display.work_area(); 1447 results->availableRect = display.work_area();
1437 results->deviceScaleFactor = display.device_scale_factor(); 1448 results->deviceScaleFactor = display.device_scale_factor();
1438 results->orientationAngle = display.RotationAsDegree(); 1449 results->orientationAngle = display.RotationAsDegree();
1439 gfx::DeviceDisplayInfo info; 1450 gfx::DeviceDisplayInfo info;
1440 results->depth = info.GetBitsPerPixel(); 1451 results->depth = info.GetBitsPerPixel();
1441 results->depthPerComponent = info.GetBitsPerComponent(); 1452 results->depthPerComponent = info.GetBitsPerComponent();
1442 results->isMonochrome = (results->depthPerComponent == 0); 1453 results->isMonochrome = (results->depthPerComponent == 0);
1443 } 1454 }
1444 1455
1445 } // namespace content 1456 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/public/browser/android/content_view_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698