Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/views/extensions/extension_view.cc

Issue 208020: Change the view mode when switching between moles and toolstrips, and (Closed)
Patch Set: build system workarounds Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/views/extensions/extension_view.h ('k') | chrome/common/view_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" 11 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
12 #endif 12 #endif
13 #include "views/widget/widget.h" 13 #include "views/widget/widget.h"
14 14
15 ExtensionView::ExtensionView(ExtensionHost* host, Browser* browser) 15 ExtensionView::ExtensionView(ExtensionHost* host, Browser* browser)
16 : host_(host), browser_(browser), 16 : host_(host), browser_(browser),
17 initialized_(false), pending_preferred_width_(0), container_(NULL), 17 initialized_(false), pending_preferred_width_(0), container_(NULL),
18 did_insert_css_(false), is_clipped_(false), is_toolstrip_(true) { 18 did_stop_loading_(false), is_clipped_(false), is_toolstrip_(true) {
19 host_->set_view(this); 19 host_->set_view(this);
20 } 20 }
21 21
22 ExtensionView::~ExtensionView() { 22 ExtensionView::~ExtensionView() {
23 View* parent = GetParent(); 23 View* parent = GetParent();
24 if (parent) 24 if (parent)
25 parent->RemoveChildView(this); 25 parent->RemoveChildView(this);
26 CleanUp(); 26 CleanUp();
27 } 27 }
28 28
29 Extension* ExtensionView::extension() const { 29 Extension* ExtensionView::extension() const {
30 return host_->extension(); 30 return host_->extension();
31 } 31 }
32 32
33 RenderViewHost* ExtensionView::render_view_host() const { 33 RenderViewHost* ExtensionView::render_view_host() const {
34 return host_->render_view_host(); 34 return host_->render_view_host();
35 } 35 }
36 36
37 void ExtensionView::SetDidInsertCSS(bool did_insert) { 37 void ExtensionView::DidStopLoading() {
38 did_insert_css_ = did_insert; 38 did_stop_loading_ = true;
39 ShowIfCompletelyLoaded(); 39 ShowIfCompletelyLoaded();
40 } 40 }
41 41
42 void ExtensionView::SetVisible(bool is_visible) { 42 void ExtensionView::SetVisible(bool is_visible) {
43 if (is_visible != IsVisible()) { 43 if (is_visible != IsVisible()) {
44 NativeViewHost::SetVisible(is_visible); 44 NativeViewHost::SetVisible(is_visible);
45 45
46 // Also tell RenderWidgetHostView the new visibility. Despite its name, it 46 // Also tell RenderWidgetHostView the new visibility. Despite its name, it
47 // is not part of the View heirarchy and does not know about the change 47 // is not part of the View heirarchy and does not know about the change
48 // unless we tell it. 48 // unless we tell it.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 render_view_host()->view()->SetBackground(pending_background_); 93 render_view_host()->view()->SetBackground(pending_background_);
94 pending_background_.reset(); 94 pending_background_.reset();
95 } 95 }
96 } 96 }
97 97
98 void ExtensionView::ShowIfCompletelyLoaded() { 98 void ExtensionView::ShowIfCompletelyLoaded() {
99 // We wait to show the ExtensionView until it has loaded, our parent has 99 // We wait to show the ExtensionView until it has loaded, our parent has
100 // given us a background and css has been inserted into page. These can happen 100 // given us a background and css has been inserted into page. These can happen
101 // in different orders. 101 // in different orders.
102 if (!IsVisible() && host_->did_stop_loading() && render_view_host()->view() && 102 if (!IsVisible() && host_->did_stop_loading() && render_view_host()->view() &&
103 !is_clipped_ && did_insert_css_ && 103 !is_clipped_ && did_stop_loading_ &&
104 !render_view_host()->view()->background().empty()) { 104 !render_view_host()->view()->background().empty()) {
105 SetVisible(true); 105 SetVisible(true);
106 UpdatePreferredWidth(pending_preferred_width_); 106 UpdatePreferredWidth(pending_preferred_width_);
107 } 107 }
108 } 108 }
109 109
110 void ExtensionView::CleanUp() { 110 void ExtensionView::CleanUp() {
111 if (!initialized_) 111 if (!initialized_)
112 return; 112 return;
113 if (native_view()) 113 if (native_view())
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 void ExtensionView::HandleMouseEvent() { 148 void ExtensionView::HandleMouseEvent() {
149 if (container_) 149 if (container_)
150 container_->OnExtensionMouseEvent(this); 150 container_->OnExtensionMouseEvent(this);
151 } 151 }
152 152
153 void ExtensionView::HandleMouseLeave() { 153 void ExtensionView::HandleMouseLeave() {
154 if (container_) 154 if (container_)
155 container_->OnExtensionMouseLeave(this); 155 container_->OnExtensionMouseLeave(this);
156 } 156 }
OLDNEW
« no previous file with comments | « chrome/browser/views/extensions/extension_view.h ('k') | chrome/common/view_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698