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, | 133 if (GetRenderWidgetHost()) |
134 ResultCodes::NORMAL_EXIT); | 134 RenderViewGone(base::TERMINATION_STATUS_NORMAL_TERMINATION, |
Greg Spencer (Chromium)
2011/01/19 21:59:38
Hmm. I can see what you mean, and in fact this is
| |
135 » » ResultCodes::NORMAL_EXIT); | |
135 } | 136 } |
136 | 137 |
137 void RenderWidgetHostViewViews::InitAsChild() { | 138 void RenderWidgetHostViewViews::InitAsChild() { |
138 Show(); | 139 Show(); |
139 } | 140 } |
140 | 141 |
141 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { | 142 RenderWidgetHost* RenderWidgetHostViewViews::GetRenderWidgetHost() const { |
142 return host_; | 143 return host_; |
143 } | 144 } |
144 | 145 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 } | 287 } |
287 } | 288 } |
288 | 289 |
289 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, | 290 void RenderWidgetHostViewViews::RenderViewGone(base::TerminationStatus status, |
290 int error_code) { | 291 int error_code) { |
291 GetRenderWidgetHost()->ViewDestroyed(); | 292 GetRenderWidgetHost()->ViewDestroyed(); |
292 Destroy(); | 293 Destroy(); |
293 } | 294 } |
294 | 295 |
295 void RenderWidgetHostViewViews::Destroy() { | 296 void RenderWidgetHostViewViews::Destroy() { |
296 // TODO(anicolao): deal with any special popup cleanup | 297 // host_'s destruction brought us here, null it out so we don't use it |
297 NOTIMPLEMENTED(); | 298 host_ = NULL; |
299 | |
300 if (GetParent()) | |
301 GetParent()->RemoveChildView(this); | |
302 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
298 } | 303 } |
299 | 304 |
300 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { | 305 void RenderWidgetHostViewViews::SetTooltipText(const std::wstring& tip) { |
301 // TODO(anicolao): decide if we want tooltips for touch (none specified | 306 // TODO(anicolao): decide if we want tooltips for touch (none specified |
302 // right now/might want a press-and-hold display) | 307 // right now/might want a press-and-hold display) |
303 // NOTIMPLEMENTED(); ... too annoying, it triggers for every mousemove | 308 // NOTIMPLEMENTED(); ... too annoying, it triggers for every mousemove |
304 } | 309 } |
305 | 310 |
306 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text) { | 311 void RenderWidgetHostViewViews::SelectionChanged(const std::string& text) { |
307 // TODO(anicolao): deal with the clipboard without GTK | 312 // TODO(anicolao): deal with the clipboard without GTK |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
753 } | 758 } |
754 | 759 |
755 // static | 760 // static |
756 RenderWidgetHostView* | 761 RenderWidgetHostView* |
757 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 762 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
758 gfx::NativeView widget) { | 763 gfx::NativeView widget) { |
759 gpointer user_data = g_object_get_data(G_OBJECT(widget), | 764 gpointer user_data = g_object_get_data(G_OBJECT(widget), |
760 kRenderWidgetHostViewKey); | 765 kRenderWidgetHostViewKey); |
761 return reinterpret_cast<RenderWidgetHostView*>(user_data); | 766 return reinterpret_cast<RenderWidgetHostView*>(user_data); |
762 } | 767 } |
OLD | NEW |