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 "base/mac/mac_util.h" | 5 #include "base/mac/mac_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 8 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
9 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 9 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
10 #import "chrome/browser/ui/cocoa/validation_message_bubble_controller.h" | 10 #import "chrome/browser/ui/cocoa/validation_message_bubble_controller.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 self.shouldOpenAsKeyWindow = NO; | 45 self.shouldOpenAsKeyWindow = NO; |
46 | 46 |
47 NSView* contentView = [ValidationMessageBubbleController | 47 NSView* contentView = [ValidationMessageBubbleController |
48 constructContentView:mainText subText:subText]; | 48 constructContentView:mainText subText:subText]; |
49 [[window contentView] addSubview:contentView]; | 49 [[window contentView] addSubview:contentView]; |
50 NSRect contentFrame = [contentView frame]; | 50 NSRect contentFrame = [contentView frame]; |
51 NSRect windowFrame = [window frame]; | 51 NSRect windowFrame = [window frame]; |
52 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; | 52 windowFrame.size.width = NSWidth(contentFrame) + kWindowPadding * 2; |
53 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 | 53 windowFrame.size.height = NSHeight(contentFrame) + kWindowPadding * 2 |
54 + info_bubble::kBubbleArrowHeight; | 54 + info_bubble::kBubbleArrowHeight; |
55 [window setFrame:windowFrame display:nil]; | 55 [window setFrame:windowFrame display:NO]; |
56 | 56 |
57 [self showWindow:nil]; | 57 [self showWindow:nil]; |
58 } | 58 } |
59 return self; | 59 return self; |
60 } | 60 } |
61 | 61 |
62 + (NSView*)constructContentView:(const base::string16&)mainText | 62 + (NSView*)constructContentView:(const base::string16&)mainText |
63 subText:(const base::string16&)subText { | 63 subText:(const base::string16&)subText { |
64 NSRect contentFrame = NSMakeRect(kWindowPadding, kWindowPadding, 0, 0); | 64 NSRect contentFrame = NSMakeRect(kWindowPadding, kWindowPadding, 0, 0); |
65 FlippedView* contentView = [[FlippedView alloc] initWithFrame:contentFrame]; | 65 FlippedView* contentView = [[FlippedView alloc] initWithFrame:contentFrame]; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 scoped_ptr<ValidationMessageBubble> ValidationMessageBubble::CreateAndShow( | 186 scoped_ptr<ValidationMessageBubble> ValidationMessageBubble::CreateAndShow( |
187 content::RenderWidgetHost* widget_host, | 187 content::RenderWidgetHost* widget_host, |
188 const gfx::Rect& anchor_in_root_view, | 188 const gfx::Rect& anchor_in_root_view, |
189 const base::string16& main_text, | 189 const base::string16& main_text, |
190 const base::string16& sub_text) { | 190 const base::string16& sub_text) { |
191 return scoped_ptr<ValidationMessageBubble>(new ValidationMessageBubbleCocoa( | 191 return scoped_ptr<ValidationMessageBubble>(new ValidationMessageBubbleCocoa( |
192 widget_host, anchor_in_root_view, main_text, sub_text)).Pass(); | 192 widget_host, anchor_in_root_view, main_text, sub_text)).Pass(); |
193 } | 193 } |
194 | 194 |
195 } | 195 } |
OLD | NEW |