Chromium Code Reviews| 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" | 31 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" |
| 32 #include "chrome/browser/ui/cocoa/restart_browser.h" | 32 #include "chrome/browser/ui/cocoa/restart_browser.h" |
| 33 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" | 33 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 34 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 34 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 35 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 35 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 36 #include "chrome/browser/ui/page_info_bubble.h" | 36 #include "chrome/browser/ui/page_info_bubble.h" |
| 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 38 #include "chrome/browser/ui/webui/task_manager/task_manager_dialog.h" | 38 #include "chrome/browser/ui/webui/task_manager/task_manager_dialog.h" |
| 39 #include "chrome/common/chrome_notification_types.h" | 39 #include "chrome/common/chrome_notification_types.h" |
| 40 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 41 #include "content/public/browser/notification_service.h" | |
| 41 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
| 42 #include "content/public/browser/native_web_keyboard_event.h" | 43 #include "content/public/browser/native_web_keyboard_event.h" |
| 43 #include "content/public/browser/notification_details.h" | 44 #include "content/public/browser/notification_details.h" |
| 44 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 45 #include "grit/chromium_strings.h" | 46 #include "grit/chromium_strings.h" |
| 46 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 47 #include "ui/base/l10n/l10n_util_mac.h" | 48 #include "ui/base/l10n/l10n_util_mac.h" |
| 48 #include "ui/gfx/rect.h" | 49 #include "ui/gfx/rect.h" |
| 49 | 50 |
| 50 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 51 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 bool BrowserWindowCocoa::IsMaximized() const { | 270 bool BrowserWindowCocoa::IsMaximized() const { |
| 270 return [window() isZoomed]; | 271 return [window() isZoomed]; |
| 271 } | 272 } |
| 272 | 273 |
| 273 bool BrowserWindowCocoa::IsMinimized() const { | 274 bool BrowserWindowCocoa::IsMinimized() const { |
| 274 return [window() isMiniaturized]; | 275 return [window() isMiniaturized]; |
| 275 } | 276 } |
| 276 | 277 |
| 277 void BrowserWindowCocoa::Maximize() { | 278 void BrowserWindowCocoa::Maximize() { |
| 278 // Zoom toggles so only call if not already maximized. | 279 // Zoom toggles so only call if not already maximized. |
| 279 if (!IsMaximized()) | 280 if (!IsMaximized()) { |
| 280 [window() zoom:controller_]; | 281 [window() zoom:controller_]; |
| 282 content::NotificationService::current()->Notify( | |
|
kkania
2012/05/30 01:03:58
I don't think we need to use a notification here i
zori
2012/05/31 23:38:22
Done.
| |
| 283 chrome::NOTIFICATION_WINDOW_MAXIMIZED, | |
| 284 content::Source<NSWindow>(window()), | |
| 285 content::NotificationService::NoDetails()); | |
| 286 } | |
| 281 } | 287 } |
| 282 | 288 |
| 283 void BrowserWindowCocoa::Minimize() { | 289 void BrowserWindowCocoa::Minimize() { |
| 284 [window() miniaturize:controller_]; | 290 [window() miniaturize:controller_]; |
| 285 } | 291 } |
| 286 | 292 |
| 287 void BrowserWindowCocoa::Restore() { | 293 void BrowserWindowCocoa::Restore() { |
| 288 if (IsMaximized()) | 294 if (IsMaximized()) |
| 289 [window() zoom:controller_]; // Toggles zoom mode. | 295 [window() zoom:controller_]; // Toggles zoom mode. |
| 290 else if (IsMinimized()) | 296 else if (IsMinimized()) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 662 AvatarMenuBubbleController* menu = | 668 AvatarMenuBubbleController* menu = |
| 663 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 669 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
| 664 anchoredAt:point]; | 670 anchoredAt:point]; |
| 665 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 671 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
| 666 [menu showWindow:nil]; | 672 [menu showWindow:nil]; |
| 667 } | 673 } |
| 668 | 674 |
| 669 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 675 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
| 670 [[controller_ avatarButtonController] showAvatarBubble]; | 676 [[controller_ avatarButtonController] showAvatarBubble]; |
| 671 } | 677 } |
| OLD | NEW |