Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 | 142 |
| 143 void RenderWidgetHostViewViews::DidBecomeSelected() { | 143 void RenderWidgetHostViewViews::DidBecomeSelected() { |
| 144 if (!is_hidden_) | 144 if (!is_hidden_) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 if (tab_switch_paint_time_.is_null()) | 147 if (tab_switch_paint_time_.is_null()) |
| 148 tab_switch_paint_time_ = base::TimeTicks::Now(); | 148 tab_switch_paint_time_ = base::TimeTicks::Now(); |
| 149 is_hidden_ = false; | 149 is_hidden_ = false; |
| 150 if (host_) | 150 if (host_) |
| 151 host_->WasRestored(); | 151 host_->WasRestored(); |
| 152 | |
| 153 if (touch_selection_controller_.get()) { | |
|
sky
2011/08/25 22:54:17
What happens if the page scrolls before you get he
varunjain
2011/08/25 23:49:22
Yes.. selection_start and end will be updated appr
| |
| 154 touch_selection_controller_->SelectionChanged(touch_selection_start_, | |
| 155 touch_selection_end_); | |
| 156 } | |
| 152 } | 157 } |
| 153 | 158 |
| 154 void RenderWidgetHostViewViews::WasHidden() { | 159 void RenderWidgetHostViewViews::WasHidden() { |
| 155 if (is_hidden_) | 160 if (is_hidden_) |
| 156 return; | 161 return; |
| 157 | 162 |
| 158 // If we receive any more paint messages while we are hidden, we want to | 163 // If we receive any more paint messages while we are hidden, we want to |
| 159 // ignore them so we don't re-allocate the backing store. We will paint | 164 // ignore them so we don't re-allocate the backing store. We will paint |
| 160 // everything again when we become selected again. | 165 // everything again when we become selected again. |
| 161 is_hidden_ = true; | 166 is_hidden_ = true; |
| 162 | 167 |
| 163 // If we have a renderer, then inform it that we are being hidden so it can | 168 // If we have a renderer, then inform it that we are being hidden so it can |
| 164 // reduce its resource utilization. | 169 // reduce its resource utilization. |
| 165 if (host_) | 170 if (host_) |
| 166 host_->WasHidden(); | 171 host_->WasHidden(); |
| 172 | |
| 173 if (touch_selection_controller_.get()) | |
| 174 touch_selection_controller_->ClientViewLostFocus(); | |
| 167 } | 175 } |
| 168 | 176 |
| 169 void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) { | 177 void RenderWidgetHostViewViews::SetSize(const gfx::Size& size) { |
| 170 // This is called when webkit has sent us a Move message. | 178 // This is called when webkit has sent us a Move message. |
| 171 int width = std::min(size.width(), kMaxWindowWidth); | 179 int width = std::min(size.width(), kMaxWindowWidth); |
| 172 int height = std::min(size.height(), kMaxWindowHeight); | 180 int height = std::min(size.height(), kMaxWindowHeight); |
| 173 if (requested_size_.width() != width || | 181 if (requested_size_.width() != width || |
| 174 requested_size_.height() != height) { | 182 requested_size_.height() != height) { |
| 175 requested_size_ = gfx::Size(width, height); | 183 requested_size_ = gfx::Size(width, height); |
| 176 views::View::SetBounds(x(), y(), width, height); | 184 views::View::SetBounds(x(), y(), width, height); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 if (GetWidget()) | 331 if (GetWidget()) |
| 324 GetWidget()->TooltipTextChanged(this); | 332 GetWidget()->TooltipTextChanged(this); |
| 325 } | 333 } |
| 326 | 334 |
| 327 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text, | 335 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text, |
| 328 const ui::Range& range, | 336 const ui::Range& range, |
| 329 const gfx::Point& start, | 337 const gfx::Point& start, |
| 330 const gfx::Point& end) { | 338 const gfx::Point& end) { |
| 331 // TODO(anicolao): deal with the clipboard without GTK | 339 // TODO(anicolao): deal with the clipboard without GTK |
| 332 NOTIMPLEMENTED(); | 340 NOTIMPLEMENTED(); |
| 341 touch_selection_start_ = start; | |
| 342 touch_selection_end_ = end; | |
| 333 if (touch_selection_controller_.get()) | 343 if (touch_selection_controller_.get()) |
| 334 touch_selection_controller_->SelectionChanged(start, end); | 344 touch_selection_controller_->SelectionChanged(start, end); |
| 335 } | 345 } |
| 336 | 346 |
| 337 void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) { | 347 void RenderWidgetHostViewViews::ShowingContextMenu(bool showing) { |
| 338 is_showing_context_menu_ = showing; | 348 is_showing_context_menu_ = showing; |
| 339 } | 349 } |
| 340 | 350 |
| 341 BackingStore* RenderWidgetHostViewViews::AllocBackingStore( | 351 BackingStore* RenderWidgetHostViewViews::AllocBackingStore( |
| 342 const gfx::Size& size) { | 352 const gfx::Size& size) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 | 802 |
| 793 void RenderWidgetHostViewViews::FinishImeCompositionSession() { | 803 void RenderWidgetHostViewViews::FinishImeCompositionSession() { |
| 794 if (!has_composition_text_) | 804 if (!has_composition_text_) |
| 795 return; | 805 return; |
| 796 if (host_) | 806 if (host_) |
| 797 host_->ImeConfirmComposition(); | 807 host_->ImeConfirmComposition(); |
| 798 DCHECK(GetInputMethod()); | 808 DCHECK(GetInputMethod()); |
| 799 GetInputMethod()->CancelComposition(this); | 809 GetInputMethod()->CancelComposition(this); |
| 800 has_composition_text_ = false; | 810 has_composition_text_ = false; |
| 801 } | 811 } |
| OLD | NEW |