| 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_view_host.h" | 7 #include "chrome/browser/extensions/extension_view_host.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 9 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 host_->CreateRenderViewSoon(); | 160 host_->CreateRenderViewSoon(); |
| 161 SetVisible(false); | 161 SetVisible(false); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void ExtensionViewViews::ShowIfCompletelyLoaded() { | 164 void ExtensionViewViews::ShowIfCompletelyLoaded() { |
| 165 if (visible() || is_clipped_) | 165 if (visible() || is_clipped_) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 // We wait to show the ExtensionViewViews until it has loaded, and the view | 168 // We wait to show the ExtensionViewViews until it has loaded, and the view |
| 169 // has actually been created. These can happen in different orders. | 169 // has actually been created. These can happen in different orders. |
| 170 if (host_->did_stop_loading()) { | 170 if (host_->has_loaded_once()) { |
| 171 SetVisible(true); | 171 SetVisible(true); |
| 172 ResizeDueToAutoResize(pending_preferred_size_); | 172 ResizeDueToAutoResize(pending_preferred_size_); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ExtensionViewViews::CleanUp() { | 176 void ExtensionViewViews::CleanUp() { |
| 177 if (!initialized_) | 177 if (!initialized_) |
| 178 return; | 178 return; |
| 179 if (native_view()) | 179 if (native_view()) |
| 180 Detach(); | 180 Detach(); |
| 181 initialized_ = false; | 181 initialized_ = false; |
| 182 } | 182 } |
| 183 | 183 |
| 184 namespace extensions { | 184 namespace extensions { |
| 185 | 185 |
| 186 // static | 186 // static |
| 187 scoped_ptr<ExtensionView> ExtensionViewHost::CreateExtensionView( | 187 scoped_ptr<ExtensionView> ExtensionViewHost::CreateExtensionView( |
| 188 ExtensionViewHost* host, | 188 ExtensionViewHost* host, |
| 189 Browser* browser) { | 189 Browser* browser) { |
| 190 scoped_ptr<ExtensionViewViews> view(new ExtensionViewViews(host, browser)); | 190 scoped_ptr<ExtensionViewViews> view(new ExtensionViewViews(host, browser)); |
| 191 // We own |view_|, so don't auto delete when it's removed from the view | 191 // We own |view_|, so don't auto delete when it's removed from the view |
| 192 // hierarchy. | 192 // hierarchy. |
| 193 view->set_owned_by_client(); | 193 view->set_owned_by_client(); |
| 194 return view.Pass(); | 194 return view.Pass(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace extensions | 197 } // namespace extensions |
| OLD | NEW |