| 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" |
| 11 #import "base/mac/sdk_forward_declarations.h" | 11 #import "base/mac/sdk_forward_declarations.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
| 18 #include "chrome/browser/extensions/tab_helper.h" | 18 #include "chrome/browser/extensions/tab_helper.h" |
| 19 #include "chrome/browser/fullscreen.h" | 19 #include "chrome/browser/fullscreen.h" |
| 20 #include "chrome/browser/password_manager/password_manager.h" | 20 #include "chrome/browser/password_manager/password_manager.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/shell_integration.h" | 22 #include "chrome/browser/shell_integration.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_command_controller.h" | 24 #include "chrome/browser/ui/browser_command_controller.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands.h" |
| 26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
| 27 #include "chrome/browser/ui/browser_window_state.h" | 27 #include "chrome/browser/ui/browser_window_state.h" |
| 28 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" | 28 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" | 29 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" |
| 30 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" | 30 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" | 31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" |
| 32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 33 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 33 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 34 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 34 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 35 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 35 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 36 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 36 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 37 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 37 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 38 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 38 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 // |menu| will automatically release itself on close. | 684 // |menu| will automatically release itself on close. |
| 685 AvatarMenuBubbleController* menu = | 685 AvatarMenuBubbleController* menu = |
| 686 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ | 686 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ |
| 687 anchoredAt:point]; | 687 anchoredAt:point]; |
| 688 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; | 688 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; |
| 689 [menu showWindow:nil]; | 689 [menu showWindow:nil]; |
| 690 } | 690 } |
| 691 | 691 |
| 692 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { | 692 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { |
| 693 AvatarButtonController* controller = [controller_ avatarButtonController]; | 693 AvatarBaseController* controller = [controller_ avatarButtonController]; |
| 694 [controller showAvatarBubble:[controller buttonView]]; | 694 [controller showAvatarBubble:[controller buttonView]]; |
| 695 } | 695 } |
| 696 | 696 |
| 697 void BrowserWindowCocoa::ShowPasswordGenerationBubble( | 697 void BrowserWindowCocoa::ShowPasswordGenerationBubble( |
| 698 const gfx::Rect& rect, | 698 const gfx::Rect& rect, |
| 699 const autofill::PasswordForm& form, | 699 const autofill::PasswordForm& form, |
| 700 autofill::PasswordGenerator* password_generator) { | 700 autofill::PasswordGenerator* password_generator) { |
| 701 WebContents* web_contents = | 701 WebContents* web_contents = |
| 702 browser_->tab_strip_model()->GetActiveWebContents(); | 702 browser_->tab_strip_model()->GetActiveWebContents(); |
| 703 // We want to point to the middle of the rect instead of the right side. | 703 // We want to point to the middle of the rect instead of the right side. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 // further, both by another H, i.e. WebContentsView's height becomes | 745 // further, both by another H, i.e. WebContentsView's height becomes |
| 746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. | 746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. |
| 747 // Strangely, the RenderWidgetHostView for the previous navigation entry also | 747 // Strangely, the RenderWidgetHostView for the previous navigation entry also |
| 748 // gets enlarged by H. | 748 // gets enlarged by H. |
| 749 // I believe these "automatic" resizing are caused by setAutoresizingMask of | 749 // I believe these "automatic" resizing are caused by setAutoresizingMask of |
| 750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of | 750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of |
| 751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of | 751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of |
| 752 // RenderWidgetHostView in (2) and (3). | 752 // RenderWidgetHostView in (2) and (3). |
| 753 return 0; | 753 return 0; |
| 754 } | 754 } |
| OLD | NEW |