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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/ui/search/search_model.h" | 44 #include "chrome/browser/ui/search/search_model.h" |
45 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
46 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 46 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
47 #include "chrome/browser/web_applications/web_app.h" | 47 #include "chrome/browser/web_applications/web_app.h" |
48 #include "chrome/common/chrome_notification_types.h" | 48 #include "chrome/common/chrome_notification_types.h" |
49 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
50 #include "content/public/browser/native_web_keyboard_event.h" | 50 #include "content/public/browser/native_web_keyboard_event.h" |
51 #include "content/public/browser/notification_details.h" | 51 #include "content/public/browser/notification_details.h" |
52 #include "content/public/browser/notification_source.h" | 52 #include "content/public/browser/notification_source.h" |
53 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| 54 #include "content/public/browser/web_contents_view.h" |
54 #include "content/public/common/password_form.h" | 55 #include "content/public/common/password_form.h" |
55 #include "grit/chromium_strings.h" | 56 #include "grit/chromium_strings.h" |
56 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
57 #include "ui/base/l10n/l10n_util_mac.h" | 58 #include "ui/base/l10n/l10n_util_mac.h" |
58 #include "ui/gfx/rect.h" | 59 #include "ui/gfx/rect.h" |
59 | 60 |
60 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 61 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
61 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" | 62 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" |
62 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h" | 63 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h" |
63 #endif | 64 #endif |
(...skipping 20 matching lines...) Expand all Loading... |
84 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; | 85 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; |
85 @end | 86 @end |
86 | 87 |
87 #endif // MAC_OS_X_VERSION_10_7 | 88 #endif // MAC_OS_X_VERSION_10_7 |
88 | 89 |
89 namespace { | 90 namespace { |
90 | 91 |
91 NSPoint GetPointForBubble(content::WebContents* web_contents, | 92 NSPoint GetPointForBubble(content::WebContents* web_contents, |
92 int x_offset, | 93 int x_offset, |
93 int y_offset) { | 94 int y_offset) { |
94 NSView* view = web_contents->GetNativeView(); | 95 NSView* view = web_contents->GetView()->GetNativeView(); |
95 NSRect bounds = [view bounds]; | 96 NSRect bounds = [view bounds]; |
96 NSPoint point; | 97 NSPoint point; |
97 point.x = NSMinX(bounds) + x_offset; | 98 point.x = NSMinX(bounds) + x_offset; |
98 // The view's origin is at the bottom but |rect|'s origin is at the top. | 99 // The view's origin is at the bottom but |rect|'s origin is at the top. |
99 point.y = NSMaxY(bounds) - y_offset; | 100 point.y = NSMaxY(bounds) - y_offset; |
100 point = [view convertPoint:point toView:nil]; | 101 point = [view convertPoint:point toView:nil]; |
101 point = [[view window] convertBaseToScreen:point]; | 102 point = [[view window] convertBaseToScreen:point]; |
102 return point; | 103 return point; |
103 } | 104 } |
104 | 105 |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 PasswordGenerationBubbleController* controller = | 702 PasswordGenerationBubbleController* controller = |
702 [[PasswordGenerationBubbleController alloc] | 703 [[PasswordGenerationBubbleController alloc] |
703 initWithWindow:browser_->window()->GetNativeWindow() | 704 initWithWindow:browser_->window()->GetNativeWindow() |
704 anchoredAt:point | 705 anchoredAt:point |
705 renderViewHost:web_contents->GetRenderViewHost() | 706 renderViewHost:web_contents->GetRenderViewHost() |
706 passwordManager:PasswordManager::FromWebContents(web_contents) | 707 passwordManager:PasswordManager::FromWebContents(web_contents) |
707 usingGenerator:password_generator | 708 usingGenerator:password_generator |
708 forForm:form]; | 709 forForm:form]; |
709 [controller showWindow:nil]; | 710 [controller showWindow:nil]; |
710 } | 711 } |
OLD | NEW |