| 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/views/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 for (MediaMenuPartsMap::const_iterator it = media_menus_.begin(); | 167 for (MediaMenuPartsMap::const_iterator it = media_menus_.begin(); |
| 168 it != media_menus_.end(); ++it) { | 168 it != media_menus_.end(); ++it) { |
| 169 if (it->second->type == type) { | 169 if (it->second->type == type) { |
| 170 it->first->SetText(base::UTF8ToUTF16(label)); | 170 it->first->SetText(base::UTF8ToUTF16(label)); |
| 171 return; | 171 return; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 NOTREACHED(); | 174 NOTREACHED(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ContentSettingBubbleContents::SetExplicitAnchorRect( |
| 178 const gfx::Rect& rect) { |
| 179 SetAnchorRect(rect); |
| 180 } |
| 181 |
| 177 void ContentSettingBubbleContents::Init() { | 182 void ContentSettingBubbleContents::Init() { |
| 178 using views::GridLayout; | 183 using views::GridLayout; |
| 179 | 184 |
| 180 GridLayout* layout = new views::GridLayout(this); | 185 GridLayout* layout = new views::GridLayout(this); |
| 181 SetLayoutManager(layout); | 186 SetLayoutManager(layout); |
| 182 | 187 |
| 183 const int kSingleColumnSetId = 0; | 188 const int kSingleColumnSetId = 0; |
| 184 views::ColumnSet* column_set = layout->AddColumnSet(kSingleColumnSetId); | 189 views::ColumnSet* column_set = layout->AddColumnSet(kSingleColumnSetId); |
| 185 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 190 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 186 GridLayout::USE_PREF, 0, 0); | 191 GridLayout::USE_PREF, 0, 0); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 // Make sure the width is at least kMinMediaMenuButtonWidth. The | 496 // Make sure the width is at least kMinMediaMenuButtonWidth. The |
| 492 // maximum width will be clamped by kMaxContentsWidth of the view. | 497 // maximum width will be clamped by kMaxContentsWidth of the view. |
| 493 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); | 498 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); |
| 494 | 499 |
| 495 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); | 500 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); |
| 496 i != media_menus_.end(); ++i) { | 501 i != media_menus_.end(); ++i) { |
| 497 i->first->SetMinSize(gfx::Size(menu_width, 0)); | 502 i->first->SetMinSize(gfx::Size(menu_width, 0)); |
| 498 i->first->SetMaxSize(gfx::Size(menu_width, 0)); | 503 i->first->SetMaxSize(gfx::Size(menu_width, 0)); |
| 499 } | 504 } |
| 500 } | 505 } |
| OLD | NEW |