| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/cocoa/browser/zoom_bubble_controller.h" | 5 #include "chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/chrome_page_zoom.h" | |
| 10 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 11 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 12 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/ui/zoom/page_zoom.h" |
| 13 #include "components/ui/zoom/zoom_controller.h" | 13 #include "components/ui/zoom/zoom_controller.h" |
| 14 #include "content/public/common/page_zoom.h" | 14 #include "content/public/common/page_zoom.h" |
| 15 #include "skia/ext/skia_utils_mac.h" | 15 #include "skia/ext/skia_utils_mac.h" |
| 16 #import "ui/base/cocoa/hover_button.h" | 16 #import "ui/base/cocoa/hover_button.h" |
| 17 #import "ui/base/cocoa/window_size_constants.h" | 17 #import "ui/base/cocoa/window_size_constants.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/native_theme/native_theme.h" | 19 #include "ui/native_theme/native_theme.h" |
| 20 | 20 |
| 21 @interface ZoomBubbleController (Private) | 21 @interface ZoomBubbleController (Private) |
| 22 - (void)performLayout; | 22 - (void)performLayout; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 - (void)zoomHelper:(content::PageZoom)alterPageZoom { | 307 - (void)zoomHelper:(content::PageZoom)alterPageZoom { |
| 308 // |delegate| can be null after -windowWillClose:. | 308 // |delegate| can be null after -windowWillClose:. |
| 309 if (!delegate_) | 309 if (!delegate_) |
| 310 return; | 310 return; |
| 311 content::WebContents* webContents = delegate_->GetWebContents(); | 311 content::WebContents* webContents = delegate_->GetWebContents(); |
| 312 | 312 |
| 313 // TODO(shess): Zoom() immediately dereferences |webContents|, and | 313 // TODO(shess): Zoom() immediately dereferences |webContents|, and |
| 314 // there haven't been associated crashes in the wild, so it seems | 314 // there haven't been associated crashes in the wild, so it seems |
| 315 // fine in practice. It might make sense to close the bubble in | 315 // fine in practice. It might make sense to close the bubble in |
| 316 // that case, though. | 316 // that case, though. |
| 317 chrome_page_zoom::Zoom(webContents, alterPageZoom); | 317 ui_zoom::PageZoom::Zoom(webContents, alterPageZoom); |
| 318 } | 318 } |
| 319 | 319 |
| 320 @end | 320 @end |
| 321 | 321 |
| 322 @implementation ZoomHoverButton | 322 @implementation ZoomHoverButton |
| 323 | 323 |
| 324 - (void)drawRect:(NSRect)rect { | 324 - (void)drawRect:(NSRect)rect { |
| 325 NSRect bounds = [self bounds]; | 325 NSRect bounds = [self bounds]; |
| 326 NSAttributedString* title = [self attributedTitle]; | 326 NSAttributedString* title = [self attributedTitle]; |
| 327 if ([self hoverState] != kHoverStateNone) { | 327 if ([self hoverState] != kHoverStateNone) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 341 range:NSMakeRange(0, [title length])]; | 341 range:NSMakeRange(0, [title length])]; |
| 342 title = selectedTitle.autorelease(); | 342 title = selectedTitle.autorelease(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 [[self cell] drawTitle:title | 345 [[self cell] drawTitle:title |
| 346 withFrame:bounds | 346 withFrame:bounds |
| 347 inView:self]; | 347 inView:self]; |
| 348 } | 348 } |
| 349 | 349 |
| 350 @end | 350 @end |
| OLD | NEW |