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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/plugins/plugin_finder.h" | 16 #include "chrome/browser/plugins/plugin_finder.h" |
17 #include "chrome/browser/plugins/plugin_metadata.h" | 17 #include "chrome/browser/plugins/plugin_metadata.h" |
18 #include "chrome/browser/ui/browser_dialogs.h" | |
18 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
19 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h" | 20 #include "chrome/browser/ui/content_settings/content_setting_media_menu_model.h" |
20 #include "chrome/browser/ui/views/browser_dialogs.h" | 21 #include "chrome/browser/ui/views/browser_dialogs.h" |
21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
22 #include "components/content_settings/core/browser/host_content_settings_map.h" | 23 #include "components/content_settings/core/browser/host_content_settings_map.h" |
23 #include "content/public/browser/plugin_service.h" | 24 #include "content/public/browser/plugin_service.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
25 #include "ui/base/cursor/cursor.h" | 26 #include "ui/base/cursor/cursor.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/models/simple_menu_model.h" | 28 #include "ui/base/models/simple_menu_model.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 // Make sure the width is at least kMinMediaMenuButtonWidth. The | 492 // Make sure the width is at least kMinMediaMenuButtonWidth. The |
492 // maximum width will be clamped by kMaxContentsWidth of the view. | 493 // maximum width will be clamped by kMaxContentsWidth of the view. |
493 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); | 494 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); |
494 | 495 |
495 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); | 496 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); |
496 i != media_menus_.end(); ++i) { | 497 i != media_menus_.end(); ++i) { |
497 i->first->SetMinSize(gfx::Size(menu_width, 0)); | 498 i->first->SetMinSize(gfx::Size(menu_width, 0)); |
498 i->first->SetMaxSize(gfx::Size(menu_width, 0)); | 499 i->first->SetMaxSize(gfx::Size(menu_width, 0)); |
499 } | 500 } |
500 } | 501 } |
502 | |
503 namespace chrome { | |
504 | |
505 void ContentSettingBubbleViewsBridge::Show(gfx::NativeView parent_view, | |
tapted
2016/01/11 23:21:38
Can this go in c/b/ui/views/browser_dialog_views_m
Elly Fong-Jones
2016/01/12 14:09:59
Done.
| |
506 ContentSettingBubbleModel* model, | |
507 content::WebContents* web_contents, | |
508 const gfx::Point& anchor) { | |
509 ContentSettingBubbleContents* contents = | |
510 new ContentSettingBubbleContents(model, web_contents, nullptr, | |
511 views::BubbleBorder::Arrow::TOP_RIGHT); | |
512 contents->set_parent_window(parent_view); | |
513 contents->SetAnchorRect(gfx::Rect(anchor, gfx::Size())); | |
514 // TODO(ellyjones): why doesn't this leak the bubble? | |
tapted
2016/01/11 23:21:39
Yeah it's spooky isn't it.. Probably CreateBubble
Elly Fong-Jones
2016/01/12 14:09:59
Ick. Ack.
| |
515 views::BubbleDelegateView::CreateBubble(contents)->Show(); | |
516 } | |
517 | |
518 } // namespace chrome | |
OLD | NEW |