| 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 "chrome/browser/ui/views/extensions/extension_view_views.h" | 5 #include "chrome/browser/ui/views/extensions/extension_view_views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 8 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ExtensionViewViews::OnFocus() { | 136 void ExtensionViewViews::OnFocus() { |
| 137 host()->host_contents()->GetView()->Focus(); | 137 host()->host_contents()->GetView()->Focus(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void ExtensionViewViews::CreateWidgetHostView() { | 140 void ExtensionViewViews::CreateWidgetHostView() { |
| 141 DCHECK(!initialized_); | 141 DCHECK(!initialized_); |
| 142 initialized_ = true; | 142 initialized_ = true; |
| 143 Attach(host_->host_contents()->GetView()->GetNativeView()); | 143 Attach(host_->host_contents()->GetView()->GetNativeView()); |
| 144 host_->CreateRenderViewSoon(); | 144 host_->CreateRenderViewSoon(base::Closure()); |
| 145 SetVisible(false); | 145 SetVisible(false); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ExtensionViewViews::ShowIfCompletelyLoaded() { | 148 void ExtensionViewViews::ShowIfCompletelyLoaded() { |
| 149 if (visible() || is_clipped_) | 149 if (visible() || is_clipped_) |
| 150 return; | 150 return; |
| 151 | 151 |
| 152 // We wait to show the ExtensionViewViews until it has loaded, and the view | 152 // We wait to show the ExtensionViewViews until it has loaded, and the view |
| 153 // has actually been created. These can happen in different orders. | 153 // has actually been created. These can happen in different orders. |
| 154 if (host_->did_stop_loading()) { | 154 if (host_->did_stop_loading()) { |
| 155 SetVisible(true); | 155 SetVisible(true); |
| 156 ResizeDueToAutoResize(pending_preferred_size_); | 156 ResizeDueToAutoResize(pending_preferred_size_); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ExtensionViewViews::CleanUp() { | 160 void ExtensionViewViews::CleanUp() { |
| 161 if (!initialized_) | 161 if (!initialized_) |
| 162 return; | 162 return; |
| 163 if (native_view()) | 163 if (native_view()) |
| 164 Detach(); | 164 Detach(); |
| 165 initialized_ = false; | 165 initialized_ = false; |
| 166 } | 166 } |
| OLD | NEW |