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

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

Issue 119103: Part 1 of dragging extensions on the shelf. This part was just about getting... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_shelf.cc ('k') | chrome/browser/views/browser_bubble.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/extensions/extension_view.h" 5 #include "chrome/browser/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)
(...skipping 24 matching lines...) Expand all
35 if (is_visible) 35 if (is_visible)
36 render_view_host()->view()->Show(); 36 render_view_host()->view()->Show();
37 else 37 else
38 render_view_host()->view()->Hide(); 38 render_view_host()->view()->Hide();
39 } 39 }
40 } 40 }
41 } 41 }
42 42
43 void ExtensionView::DidChangeBounds(const gfx::Rect& previous, 43 void ExtensionView::DidChangeBounds(const gfx::Rect& previous,
44 const gfx::Rect& current) { 44 const gfx::Rect& current) {
45 View::DidChangeBounds(previous, current);
45 // Propagate the new size to RenderWidgetHostView. 46 // Propagate the new size to RenderWidgetHostView.
46 // We can't send size zero because RenderWidget DCHECKs that. 47 // We can't send size zero because RenderWidget DCHECKs that.
47 if (render_view_host()->view() && !current.IsEmpty()) 48 if (render_view_host()->view() && !current.IsEmpty())
48 render_view_host()->view()->SetSize(gfx::Size(width(), height())); 49 render_view_host()->view()->SetSize(gfx::Size(width(), height()));
49 // Layout is where the HWND is properly positioned.
50 // TODO(erikkay) - perhaps this should be in NativeViewHost
51 Layout();
52 } 50 }
53 51
54 void ExtensionView::ShowIfCompletelyLoaded() { 52 void ExtensionView::ShowIfCompletelyLoaded() {
55 // We wait to show the ExtensionView until it has loaded and our parent has 53 // We wait to show the ExtensionView until it has loaded and our parent has
56 // given us a background. These can happen in different orders. 54 // given us a background. These can happen in different orders.
57 if (!IsVisible() && host_->did_stop_loading() && render_view_host()->view() && 55 if (!IsVisible() && host_->did_stop_loading() && render_view_host()->view() &&
58 !render_view_host()->view()->background().empty()) { 56 !render_view_host()->view()->background().empty()) {
59 SetVisible(true); 57 SetVisible(true);
60 DidContentsPreferredWidthChange(pending_preferred_width_); 58 DidContentsPreferredWidthChange(pending_preferred_width_);
61 } 59 }
(...skipping 17 matching lines...) Expand all
79 SetPreferredSize(gfx::Size(pref_width, height())); 77 SetPreferredSize(gfx::Size(pref_width, height()));
80 } 78 }
81 } 79 }
82 80
83 void ExtensionView::ViewHierarchyChanged(bool is_add, 81 void ExtensionView::ViewHierarchyChanged(bool is_add,
84 views::View *parent, 82 views::View *parent,
85 views::View *child) { 83 views::View *child) {
86 NativeViewHost::ViewHierarchyChanged(is_add, parent, child); 84 NativeViewHost::ViewHierarchyChanged(is_add, parent, child);
87 if (is_add && GetWidget() && !initialized_) { 85 if (is_add && GetWidget() && !initialized_) {
88 initialized_ = true; 86 initialized_ = true;
89 87 RenderWidgetHostView* view =
90 RenderWidgetHostView* view = RenderWidgetHostView::CreateViewForWidget( 88 RenderWidgetHostView::CreateViewForWidget(render_view_host());
91 render_view_host());
92 89
93 // TODO(mpcomplete): RWHV needs a cross-platform Init function. 90 // TODO(mpcomplete): RWHV needs a cross-platform Init function.
94 #if defined(OS_WIN) 91 #if defined(OS_WIN)
95 // Create the HWND. Note: 92 // Create the HWND. Note:
96 // RenderWidgetHostHWND supports windowed plugins, but if we ever also 93 // RenderWidgetHostHWND supports windowed plugins, but if we ever also
97 // wanted to support constrained windows with this, we would need an 94 // wanted to support constrained windows with this, we would need an
98 // additional HWND to parent off of because windowed plugin HWNDs cannot 95 // additional HWND to parent off of because windowed plugin HWNDs cannot
99 // exist in the same z-order as constrained windows. 96 // exist in the same z-order as constrained windows.
100 RenderWidgetHostViewWin* view_win = 97 RenderWidgetHostViewWin* view_win =
101 static_cast<RenderWidgetHostViewWin*>(view); 98 static_cast<RenderWidgetHostViewWin*>(view);
(...skipping 16 matching lines...) Expand all
118 115
119 void ExtensionView::HandleMouseEvent() { 116 void ExtensionView::HandleMouseEvent() {
120 if (container_) 117 if (container_)
121 container_->OnExtensionMouseEvent(this); 118 container_->OnExtensionMouseEvent(this);
122 } 119 }
123 120
124 void ExtensionView::HandleMouseLeave() { 121 void ExtensionView::HandleMouseLeave() {
125 if (container_) 122 if (container_)
126 container_->OnExtensionMouseLeave(this); 123 container_->OnExtensionMouseLeave(this);
127 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_shelf.cc ('k') | chrome/browser/views/browser_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698