| 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/views/extensions/extension_view.h" | 5 #include "chrome/browser/views/extensions/extension_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
| 9 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 9 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 10 #include "chrome/browser/views/extensions/extension_popup.h" | 10 #include "chrome/browser/views/extensions/extension_popup.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 SetVisible(false); | 113 SetVisible(false); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ExtensionView::ShowIfCompletelyLoaded() { | 116 void ExtensionView::ShowIfCompletelyLoaded() { |
| 117 if (IsVisible() || is_clipped_) | 117 if (IsVisible() || is_clipped_) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 // We wait to show the ExtensionView until it has loaded, and the view has | 120 // We wait to show the ExtensionView until it has loaded, and the view has |
| 121 // actually been created. These can happen in different orders. | 121 // actually been created. These can happen in different orders. |
| 122 if (host_->did_stop_loading()) { | 122 if (host_->did_stop_loading()) { |
| 123 // For toolstrips, also wait until our parent has given us a background. | |
| 124 if (host_->GetRenderViewType() == ViewType::EXTENSION_TOOLSTRIP && | |
| 125 render_view_host()->view()->background().empty()) { | |
| 126 return; | |
| 127 } | |
| 128 SetVisible(true); | 123 SetVisible(true); |
| 129 | |
| 130 UpdatePreferredSize(pending_preferred_size_); | 124 UpdatePreferredSize(pending_preferred_size_); |
| 131 } | 125 } |
| 132 } | 126 } |
| 133 | 127 |
| 134 void ExtensionView::CleanUp() { | 128 void ExtensionView::CleanUp() { |
| 135 if (!initialized_) | 129 if (!initialized_) |
| 136 return; | 130 return; |
| 137 if (native_view()) | 131 if (native_view()) |
| 138 Detach(); | 132 Detach(); |
| 139 initialized_ = false; | 133 initialized_ = false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 render_view_host()->view()->SetBackground(pending_background_); | 191 render_view_host()->view()->SetBackground(pending_background_); |
| 198 pending_background_.reset(); | 192 pending_background_.reset(); |
| 199 } | 193 } |
| 200 | 194 |
| 201 // Tell the renderer not to draw scroll bars in popups unless the | 195 // Tell the renderer not to draw scroll bars in popups unless the |
| 202 // popups are at the maximum allowed size. | 196 // popups are at the maximum allowed size. |
| 203 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, | 197 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, |
| 204 ExtensionPopup::kMaxHeight); | 198 ExtensionPopup::kMaxHeight); |
| 205 host_->DisableScrollbarsForSmallWindows(largest_popup_size); | 199 host_->DisableScrollbarsForSmallWindows(largest_popup_size); |
| 206 } | 200 } |
| OLD | NEW |