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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 7 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
8 | 8 |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/common/chrome_view_type.h" | 10 #include "chrome/common/view_type.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents_view.h" | 14 #include "content/public/browser/web_contents_view.h" |
15 | 15 |
16 // The minimum/maximum dimensions of the popup. | 16 // The minimum/maximum dimensions of the popup. |
17 const CGFloat ExtensionViewMac::kMinWidth = 25.0; | 17 const CGFloat ExtensionViewMac::kMinWidth = 25.0; |
18 const CGFloat ExtensionViewMac::kMinHeight = 25.0; | 18 const CGFloat ExtensionViewMac::kMinHeight = 25.0; |
19 const CGFloat ExtensionViewMac::kMaxWidth = 800.0; | 19 const CGFloat ExtensionViewMac::kMaxWidth = 800.0; |
20 const CGFloat ExtensionViewMac::kMaxHeight = 600.0; | 20 const CGFloat ExtensionViewMac::kMaxHeight = 600.0; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (container_) | 60 if (container_) |
61 container_->OnExtensionSizeChanged(this, new_size); | 61 container_->OnExtensionSizeChanged(this, new_size); |
62 } | 62 } |
63 | 63 |
64 void ExtensionViewMac::RenderViewCreated() { | 64 void ExtensionViewMac::RenderViewCreated() { |
65 if (!pending_background_.empty() && render_view_host()->GetView()) { | 65 if (!pending_background_.empty() && render_view_host()->GetView()) { |
66 render_view_host()->GetView()->SetBackground(pending_background_); | 66 render_view_host()->GetView()->SetBackground(pending_background_); |
67 pending_background_.reset(); | 67 pending_background_.reset(); |
68 } | 68 } |
69 | 69 |
70 content::ViewType host_type = extension_host_->extension_host_type(); | 70 chrome::ViewType host_type = extension_host_->extension_host_type(); |
71 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 71 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
72 gfx::Size min_size(ExtensionViewMac::kMinWidth, | 72 gfx::Size min_size(ExtensionViewMac::kMinWidth, |
73 ExtensionViewMac::kMinHeight); | 73 ExtensionViewMac::kMinHeight); |
74 gfx::Size max_size(ExtensionViewMac::kMaxWidth, | 74 gfx::Size max_size(ExtensionViewMac::kMaxWidth, |
75 ExtensionViewMac::kMaxHeight); | 75 ExtensionViewMac::kMaxHeight); |
76 render_view_host()->EnableAutoResize(min_size, max_size); | 76 render_view_host()->EnableAutoResize(min_size, max_size); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void ExtensionViewMac::WindowFrameChanged() { | 80 void ExtensionViewMac::WindowFrameChanged() { |
81 if (render_view_host()->GetView()) | 81 if (render_view_host()->GetView()) |
82 render_view_host()->GetView()->WindowFrameChanged(); | 82 render_view_host()->GetView()->WindowFrameChanged(); |
83 } | 83 } |
84 | 84 |
85 void ExtensionViewMac::CreateWidgetHostView() { | 85 void ExtensionViewMac::CreateWidgetHostView() { |
86 extension_host_->CreateRenderViewSoon(); | 86 extension_host_->CreateRenderViewSoon(); |
87 } | 87 } |
88 | 88 |
89 void ExtensionViewMac::ShowIfCompletelyLoaded() { | 89 void ExtensionViewMac::ShowIfCompletelyLoaded() { |
90 // We wait to show the ExtensionView until it has loaded, and the view has | 90 // We wait to show the ExtensionView until it has loaded, and the view has |
91 // actually been created. These can happen in different orders. | 91 // actually been created. These can happen in different orders. |
92 if (extension_host_->did_stop_loading()) { | 92 if (extension_host_->did_stop_loading()) { |
93 [native_view() setHidden:NO]; | 93 [native_view() setHidden:NO]; |
94 if (container_) | 94 if (container_) |
95 container_->OnExtensionViewDidShow(this); | 95 container_->OnExtensionViewDidShow(this); |
96 } | 96 } |
97 } | 97 } |
OLD | NEW |