OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 is_loading_(false), | 123 is_loading_(false), |
124 native_cursor_(NULL), | 124 native_cursor_(NULL), |
125 is_showing_context_menu_(false), | 125 is_showing_context_menu_(false), |
126 visually_deemphasized_(false), | 126 visually_deemphasized_(false), |
127 touch_event_() { | 127 touch_event_() { |
128 SetFocusable(true); | 128 SetFocusable(true); |
129 host_->set_view(this); | 129 host_->set_view(this); |
130 } | 130 } |
131 | 131 |
132 RenderWidgetHostViewViews::~RenderWidgetHostViewViews() { | 132 RenderWidgetHostViewViews::~RenderWidgetHostViewViews() { |
133 RenderViewGone(base::TERMINATION_STATUS_NORMAL_TERMINATION, | |
134 ResultCodes::NORMAL_EXIT); | |
135 } | 133 } |
136 | 134 |
137 void RenderWidgetHostViewViews::InitAsChild() { | 135 void RenderWidgetHostViewViews::InitAsChild() { |
138 Show(); | 136 Show(); |
139 } | 137 } |
140 | 138 |
141 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { | 139 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { |
142 return host_; | 140 return host_; |
143 } | 141 } |
144 | 142 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } | 284 } |
287 } | 285 } |
288 | 286 |
289 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, | 287 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, |
290 int error_code) { | 288 int error_code) { |
291 GetRenderWidgetHost()->ViewDestroyed(); | 289 GetRenderWidgetHost()->ViewDestroyed(); |
292 Destroy(); | 290 Destroy(); |
293 } | 291 } |
294 | 292 |
295 void RenderWidgetHostViewViews::Destroy() { | 293 void RenderWidgetHostViewViews::Destroy() { |
296 // TODO(anicolao): deal with any special popup cleanup | 294 // host_'s destruction brought us here, null it out so we don't use it |
297 NOTIMPLEMENTED(); | 295 host_ = NULL; |
| 296 |
| 297 if (GetParent()) |
| 298 GetParent()->RemoveChildView(this); |
| 299 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
298 } | 300 } |
299 | 301 |
300 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { | 302 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { |
301 // TODO(anicolao): decide if we want tooltips for touch (none specified | 303 // TODO(anicolao): decide if we want tooltips for touch (none specified |
302 // right now/might want a press-and-hold display) | 304 // right now/might want a press-and-hold display) |
303 // NOTIMPLEMENTED(); ... too annoying, it triggers for every mousemove | 305 // NOTIMPLEMENTED(); ... too annoying, it triggers for every mousemove |
304 } | 306 } |
305 | 307 |
306 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text) { | 308 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text) { |
307 // TODO(anicolao): deal with the clipboard without GTK | 309 // TODO(anicolao): deal with the clipboard without GTK |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 755 } |
754 | 756 |
755 // static | 757 // static |
756 RenderWidgetHostView* | 758 RenderWidgetHostView* |
757 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 759 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
758 gfx::NativeView widget) { | 760 gfx::NativeView widget) { |
759 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 761 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
760 kRenderWidgetHostViewKey); | 762 kRenderWidgetHostViewKey); |
761 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 763 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
762 } | 764 } |
OLD | NEW |