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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_view_mac.mm

Issue 13375017: Move the ViewType enum to extensions\common. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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
OLDNEW
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/view_type.h"
11 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/render_widget_host_view.h" 11 #include "content/public/browser/render_widget_host_view.h"
13 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
14 #include "extensions/common/view_type.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;
21 21
22 ExtensionViewMac::ExtensionViewMac(extensions::ExtensionHost* extension_host, 22 ExtensionViewMac::ExtensionViewMac(extensions::ExtensionHost* extension_host,
23 Browser* browser) 23 Browser* browser)
24 : browser_(browser), 24 : browser_(browser),
(...skipping 21 matching lines...) Expand all
46 void ExtensionViewMac::DidStopLoading() { 46 void ExtensionViewMac::DidStopLoading() {
47 ShowIfCompletelyLoaded(); 47 ShowIfCompletelyLoaded();
48 } 48 }
49 49
50 void ExtensionViewMac::ResizeDueToAutoResize(const gfx::Size& new_size) { 50 void ExtensionViewMac::ResizeDueToAutoResize(const gfx::Size& new_size) {
51 if (container_) 51 if (container_)
52 container_->OnExtensionSizeChanged(this, new_size); 52 container_->OnExtensionSizeChanged(this, new_size);
53 } 53 }
54 54
55 void ExtensionViewMac::RenderViewCreated() { 55 void ExtensionViewMac::RenderViewCreated() {
56 chrome::ViewType host_type = extension_host_->extension_host_type(); 56 extensions::ViewType host_type = extension_host_->extension_host_type();
57 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { 57 if (host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) {
58 gfx::Size min_size(ExtensionViewMac::kMinWidth, 58 gfx::Size min_size(ExtensionViewMac::kMinWidth,
59 ExtensionViewMac::kMinHeight); 59 ExtensionViewMac::kMinHeight);
60 gfx::Size max_size(ExtensionViewMac::kMaxWidth, 60 gfx::Size max_size(ExtensionViewMac::kMaxWidth,
61 ExtensionViewMac::kMaxHeight); 61 ExtensionViewMac::kMaxHeight);
62 render_view_host()->EnableAutoResize(min_size, max_size); 62 render_view_host()->EnableAutoResize(min_size, max_size);
63 } 63 }
64 } 64 }
65 65
66 void ExtensionViewMac::WindowFrameChanged() { 66 void ExtensionViewMac::WindowFrameChanged() {
67 if (render_view_host()->GetView()) 67 if (render_view_host()->GetView())
68 render_view_host()->GetView()->WindowFrameChanged(); 68 render_view_host()->GetView()->WindowFrameChanged();
69 } 69 }
70 70
71 void ExtensionViewMac::CreateWidgetHostView() { 71 void ExtensionViewMac::CreateWidgetHostView() {
72 extension_host_->CreateRenderViewSoon(); 72 extension_host_->CreateRenderViewSoon();
73 } 73 }
74 74
75 void ExtensionViewMac::ShowIfCompletelyLoaded() { 75 void ExtensionViewMac::ShowIfCompletelyLoaded() {
76 // We wait to show the ExtensionView until it has loaded, and the view has 76 // We wait to show the ExtensionView until it has loaded, and the view has
77 // actually been created. These can happen in different orders. 77 // actually been created. These can happen in different orders.
78 if (extension_host_->did_stop_loading()) { 78 if (extension_host_->did_stop_loading()) {
79 [native_view() setHidden:NO]; 79 [native_view() setHidden:NO];
80 if (container_) 80 if (container_)
81 container_->OnExtensionViewDidShow(this); 81 container_->OnExtensionViewDidShow(this);
82 } 82 }
83 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698