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_delegate_impl.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_mac.h" | 25 #include "chrome/browser/ui/browser_commands_mac.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_base_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" |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
704 NSPoint point = GetPointForBubble(web_contents, | 704 NSPoint point = GetPointForBubble(web_contents, |
705 rect.x() + rect.width()/2, | 705 rect.x() + rect.width()/2, |
706 rect.bottom()); | 706 rect.bottom()); |
707 | 707 |
708 PasswordGenerationBubbleController* controller = | 708 PasswordGenerationBubbleController* controller = [ |
709 [[PasswordGenerationBubbleController alloc] | 709 [PasswordGenerationBubbleController alloc] |
710 initWithWindow:browser_->window()->GetNativeWindow() | 710 initWithWindow:browser_->window()->GetNativeWindow() |
711 anchoredAt:point | 711 anchoredAt:point |
712 renderViewHost:web_contents->GetRenderViewHost() | 712 renderViewHost:web_contents->GetRenderViewHost() |
713 passwordManager:PasswordManager::FromWebContents(web_contents) | 713 passwordManager:PasswordManagerDelegateImpl::GetManagerFromWebContents( |
714 usingGenerator:password_generator | 714 web_contents) |
715 forForm:form]; | 715 usingGenerator:password_generator |
| 716 forForm:form]; |
716 [controller showWindow:nil]; | 717 [controller showWindow:nil]; |
717 } | 718 } |
718 | 719 |
719 int | 720 int |
720 BrowserWindowCocoa::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 721 BrowserWindowCocoa::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
721 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) | 722 if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED) |
722 return 0; | 723 return 0; |
723 // TODO(sail): please make this work with cocoa, then enable | 724 // TODO(sail): please make this work with cocoa, then enable |
724 // BrowserTest.GetSizeForNewRenderView and | 725 // BrowserTest.GetSizeForNewRenderView and |
725 // WebContentsImplBrowserTest.GetSizeForNewRenderView. | 726 // WebContentsImplBrowserTest.GetSizeForNewRenderView. |
(...skipping 19 matching lines...) Expand all Loading... |
745 // further, both by another H, i.e. WebContentsView's height becomes | 746 // further, both by another H, i.e. WebContentsView's height becomes |
746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. | 747 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. |
747 // Strangely, the RenderWidgetHostView for the previous navigation entry also | 748 // Strangely, the RenderWidgetHostView for the previous navigation entry also |
748 // gets enlarged by H. | 749 // gets enlarged by H. |
749 // I believe these "automatic" resizing are caused by setAutoresizingMask of | 750 // I believe these "automatic" resizing are caused by setAutoresizingMask of |
750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of | 751 // of the cocoa view in WebContentsViewMac, which defeats the purpose of |
751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of | 752 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of |
752 // RenderWidgetHostView in (2) and (3). | 753 // RenderWidgetHostView in (2) and (3). |
753 return 0; | 754 return 0; |
754 } | 755 } |
OLD | NEW |