OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { | 126 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { |
127 gfx::Size preferred_size(views::View::GetPreferredSize()); | 127 gfx::Size preferred_size(views::View::GetPreferredSize()); |
128 int preferred_width = | 128 int preferred_width = |
129 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && | 129 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && |
130 (kMinMultiLineContentsWidth > preferred_size.width())) ? | 130 (kMinMultiLineContentsWidth > preferred_size.width())) ? |
131 kMinMultiLineContentsWidth : preferred_size.width(); | 131 kMinMultiLineContentsWidth : preferred_size.width(); |
132 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); | 132 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); |
133 return preferred_size; | 133 return preferred_size; |
134 } | 134 } |
135 | 135 |
136 gfx::Point ContentSettingBubbleContents::GetAnchorPoint() { | 136 gfx::Rect ContentSettingBubbleContents::GetAnchorRect() { |
137 return BubbleDelegateView::GetAnchorPoint().Subtract(gfx::Point(0, 5)); | 137 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); |
138 rect.Offset(0, -5); | |
msw
2011/12/08 00:40:14
Please change this to rect.Inset(5, 5);? Thanks!
| |
139 return rect; | |
138 } | 140 } |
139 | 141 |
140 void ContentSettingBubbleContents::Init() { | 142 void ContentSettingBubbleContents::Init() { |
141 using views::GridLayout; | 143 using views::GridLayout; |
142 | 144 |
143 GridLayout* layout = new views::GridLayout(this); | 145 GridLayout* layout = new views::GridLayout(this); |
144 SetLayoutManager(layout); | 146 SetLayoutManager(layout); |
145 | 147 |
146 const int single_column_set_id = 0; | 148 const int single_column_set_id = 0; |
147 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set_id); | 149 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set_id); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 } | 331 } |
330 | 332 |
331 void ContentSettingBubbleContents::Observe( | 333 void ContentSettingBubbleContents::Observe( |
332 int type, | 334 int type, |
333 const content::NotificationSource& source, | 335 const content::NotificationSource& source, |
334 const content::NotificationDetails& details) { | 336 const content::NotificationDetails& details) { |
335 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); | 337 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); |
336 DCHECK(source == content::Source<TabContents>(tab_contents_)); | 338 DCHECK(source == content::Source<TabContents>(tab_contents_)); |
337 tab_contents_ = NULL; | 339 tab_contents_ = NULL; |
338 } | 340 } |
OLD | NEW |