| 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 "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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 } // anonymous namespace | 123 } // anonymous namespace |
| 124 | 124 |
| 125 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 125 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
| 126 RenderWidgetHostImpl* widget_host, | 126 RenderWidgetHostImpl* widget_host, |
| 127 ContentViewCoreImpl* content_view_core) | 127 ContentViewCoreImpl* content_view_core) |
| 128 : host_(widget_host), | 128 : host_(widget_host), |
| 129 needs_begin_frame_(false), | 129 needs_begin_frame_(false), |
| 130 is_showing_(!widget_host->is_hidden()), | 130 is_showing_(!widget_host->is_hidden()), |
| 131 content_view_core_(NULL), | 131 content_view_core_(NULL), |
| 132 ime_adapter_android_(this), | 132 ime_adapter_android_(new ImeAdapterAndroid(this)), |
| 133 cached_background_color_(SK_ColorWHITE), | 133 cached_background_color_(SK_ColorWHITE), |
| 134 texture_id_in_layer_(0), | 134 texture_id_in_layer_(0), |
| 135 last_output_surface_id_(kUndefinedOutputSurfaceId), | 135 last_output_surface_id_(kUndefinedOutputSurfaceId), |
| 136 weak_ptr_factory_(this), | 136 weak_ptr_factory_(this), |
| 137 overscroll_effect_enabled_( | 137 overscroll_effect_enabled_( |
| 138 !CommandLine::ForCurrentProcess()-> | 138 !CommandLine::ForCurrentProcess()-> |
| 139 HasSwitch(switches::kDisableOverscrollEdgeEffect)), | 139 HasSwitch(switches::kDisableOverscrollEdgeEffect)), |
| 140 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), | 140 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), |
| 141 flush_input_requested_(false), | 141 flush_input_requested_(false), |
| 142 accelerated_surface_route_id_(0), | 142 accelerated_surface_route_id_(0), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 165 if (texture_id_in_layer_) { | 165 if (texture_id_in_layer_) { |
| 166 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture( | 166 ImageTransportFactoryAndroid::GetInstance()->DeleteTexture( |
| 167 texture_id_in_layer_); | 167 texture_id_in_layer_); |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (texture_layer_.get()) | 170 if (texture_layer_.get()) |
| 171 texture_layer_->ClearClient(); | 171 texture_layer_->ClearClient(); |
| 172 | 172 |
| 173 if (resource_collection_.get()) | 173 if (resource_collection_.get()) |
| 174 resource_collection_->SetClient(NULL); | 174 resource_collection_->SetClient(NULL); |
| 175 ime_adapter_android_->RenderWidgetGone(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 | 178 |
| 178 bool RenderWidgetHostViewAndroid::OnMessageReceived( | 179 bool RenderWidgetHostViewAndroid::OnMessageReceived( |
| 179 const IPC::Message& message) { | 180 const IPC::Message& message) { |
| 180 bool handled = true; | 181 bool handled = true; |
| 181 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) | 182 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAndroid, message) |
| 182 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) | 183 IPC_MESSAGE_HANDLER(ViewHostMsg_StartContentIntent, OnStartContentIntent) |
| 183 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, | 184 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeBodyBackgroundColor, |
| 184 OnDidChangeBodyBackgroundColor) | 185 OnDidChangeBodyBackgroundColor) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 423 } |
| 423 | 424 |
| 424 void RenderWidgetHostViewAndroid::TextInputTypeChanged( | 425 void RenderWidgetHostViewAndroid::TextInputTypeChanged( |
| 425 ui::TextInputType type, | 426 ui::TextInputType type, |
| 426 ui::TextInputMode input_mode, | 427 ui::TextInputMode input_mode, |
| 427 bool can_compose_inline) { | 428 bool can_compose_inline) { |
| 428 // Unused on Android, which uses OnTextInputChanged instead. | 429 // Unused on Android, which uses OnTextInputChanged instead. |
| 429 } | 430 } |
| 430 | 431 |
| 431 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 432 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
| 432 return reinterpret_cast<intptr_t>(&ime_adapter_android_); | 433 return reinterpret_cast<intptr_t>(ime_adapter_android_.get()); |
| 433 } | 434 } |
| 434 | 435 |
| 435 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( | 436 void RenderWidgetHostViewAndroid::OnTextInputStateChanged( |
| 436 const ViewHostMsg_TextInputState_Params& params) { | 437 const ViewHostMsg_TextInputState_Params& params) { |
| 437 // If an acknowledgement is required for this event, regardless of how we exit | 438 // If an acknowledgement is required for this event, regardless of how we exit |
| 438 // from this method, we must acknowledge that we processed the input state | 439 // from this method, we must acknowledge that we processed the input state |
| 439 // change. | 440 // change. |
| 440 base::ScopedClosureRunner ack_caller; | 441 base::ScopedClosureRunner ack_caller; |
| 441 if (params.require_ack) | 442 if (params.require_ack) |
| 442 ack_caller.Reset(base::Bind(&SendImeEventAck, host_)); | 443 ack_caller.Reset(base::Bind(&SendImeEventAck, host_)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 const base::string16& result) { | 505 const base::string16& result) { |
| 505 // Custom serialization over IPC isn't allowed normally for security reasons. | 506 // Custom serialization over IPC isn't allowed normally for security reasons. |
| 506 // Since this feature is only used in (single-process) WebView, there are no | 507 // Since this feature is only used in (single-process) WebView, there are no |
| 507 // security issues. Enforce that it's only called in single process mode. | 508 // security issues. Enforce that it's only called in single process mode. |
| 508 CHECK(RenderProcessHost::run_renderer_in_process()); | 509 CHECK(RenderProcessHost::run_renderer_in_process()); |
| 509 if (content_view_core_) | 510 if (content_view_core_) |
| 510 content_view_core_->OnSmartClipDataExtracted(result); | 511 content_view_core_->OnSmartClipDataExtracted(result); |
| 511 } | 512 } |
| 512 | 513 |
| 513 void RenderWidgetHostViewAndroid::ImeCancelComposition() { | 514 void RenderWidgetHostViewAndroid::ImeCancelComposition() { |
| 514 ime_adapter_android_.CancelComposition(); | 515 ime_adapter_android_->CancelComposition(); |
| 515 } | 516 } |
| 516 | 517 |
| 517 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { | 518 void RenderWidgetHostViewAndroid::FocusedNodeChanged(bool is_editable_node) { |
| 518 ime_adapter_android_.FocusedNodeChanged(is_editable_node); | 519 ime_adapter_android_->FocusedNodeChanged(is_editable_node); |
| 519 } | 520 } |
| 520 | 521 |
| 521 void RenderWidgetHostViewAndroid::DidUpdateBackingStore( | 522 void RenderWidgetHostViewAndroid::DidUpdateBackingStore( |
| 522 const gfx::Rect& scroll_rect, | 523 const gfx::Rect& scroll_rect, |
| 523 const gfx::Vector2d& scroll_delta, | 524 const gfx::Vector2d& scroll_delta, |
| 524 const std::vector<gfx::Rect>& copy_rects, | 525 const std::vector<gfx::Rect>& copy_rects, |
| 525 const std::vector<ui::LatencyInfo>& latency_info) { | 526 const std::vector<ui::LatencyInfo>& latency_info) { |
| 526 NOTIMPLEMENTED(); | 527 NOTIMPLEMENTED(); |
| 527 } | 528 } |
| 528 | 529 |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 // RenderWidgetHostView, public: | 1406 // RenderWidgetHostView, public: |
| 1406 | 1407 |
| 1407 // static | 1408 // static |
| 1408 RenderWidgetHostView* | 1409 RenderWidgetHostView* |
| 1409 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1410 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 1410 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1411 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 1411 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1412 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 1412 } | 1413 } |
| 1413 | 1414 |
| 1414 } // namespace content | 1415 } // namespace content |
| OLD | NEW |