| 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 "chrome/browser/ui/cocoa/infobars/extension_infobar_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/extension_infobar_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 10 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 21 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_contents_view.h" | 23 #include "content/public/browser/web_contents_view.h" |
| 24 #include "extensions/common/extension_resource.h" | 24 #include "extensions/common/extension_resource.h" |
| 25 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 26 #include "skia/ext/skia_utils_mac.h" | 26 #include "skia/ext/skia_utils_mac.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/canvas.h" | 28 #include "ui/gfx/canvas.h" |
| 29 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
| 30 | 30 |
| 31 namespace { | |
| 32 const CGFloat kAnimationDuration = 0.12; | |
| 33 const CGFloat kBottomBorderHeightPx = 1.0; | 31 const CGFloat kBottomBorderHeightPx = 1.0; |
| 34 const CGFloat kButtonHeightPx = 26.0; | 32 const CGFloat kButtonHeightPx = 26.0; |
| 35 const CGFloat kButtonLeftMarginPx = 2.0; | 33 const CGFloat kButtonLeftMarginPx = 2.0; |
| 36 const CGFloat kButtonWidthPx = 34.0; | 34 const CGFloat kButtonWidthPx = 34.0; |
| 37 const CGFloat kDropArrowLeftMarginPx = 3.0; | 35 const CGFloat kDropArrowLeftMarginPx = 3.0; |
| 38 const CGFloat kToolbarMinHeightPx = 36.0; | 36 const CGFloat kToolbarMinHeightPx = 36.0; |
| 39 const CGFloat kToolbarMaxHeightPx = 72.0; | 37 const CGFloat kToolbarMaxHeightPx = 72.0; |
| 40 } // namespace | |
| 41 | 38 |
| 42 @interface ExtensionInfoBarController(Private) | 39 @interface ExtensionInfoBarController(Private) |
| 43 // Called when the extension's hosted NSView has been resized. | 40 // Called when the extension's hosted NSView has been resized. |
| 44 - (void)extensionViewFrameChanged; | 41 - (void)extensionViewFrameChanged; |
| 45 // Returns the clamped height of the extension view to be within the min and max | 42 // Returns the clamped height of the extension view to be within the min and max |
| 46 // values defined above. | 43 // values defined above. |
| 47 - (CGFloat)clampedExtensionViewHeight; | 44 - (CGFloat)clampedExtensionViewHeight; |
| 48 // Adjusts the width of the extension's hosted view to match the window's width | 45 // Adjusts the width of the extension's hosted view to match the window's width |
| 49 // and sets the proper height for it as well. | 46 // and sets the proper height for it as well. |
| 50 - (void)adjustExtensionViewSize; | 47 - (void)adjustExtensionViewSize; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(owner, this)); | 266 scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(owner, this)); |
| 270 NSWindow* window = | 267 NSWindow* window = |
| 271 [(NSView*)owner->web_contents()->GetView()->GetContentNativeView() | 268 [(NSView*)owner->web_contents()->GetView()->GetContentNativeView() |
| 272 window]; | 269 window]; |
| 273 base::scoped_nsobject<ExtensionInfoBarController> controller( | 270 base::scoped_nsobject<ExtensionInfoBarController> controller( |
| 274 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get() | 271 [[ExtensionInfoBarController alloc] initWithInfoBar:infobar.get() |
| 275 window:window]); | 272 window:window]); |
| 276 infobar->set_controller(controller); | 273 infobar->set_controller(controller); |
| 277 return infobar.release(); | 274 return infobar.release(); |
| 278 } | 275 } |
| OLD | NEW |