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/gtk/content_setting_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/content_settings.h" | 24 #include "chrome/common/content_settings.h" |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/plugin_service.h" | 27 #include "content/public/browser/plugin_service.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
30 #include "grit/ui_resources.h" | 30 #include "grit/ui_resources.h" |
31 #include "ui/base/gtk/gtk_hig_constants.h" | 31 #include "ui/base/gtk/gtk_hig_constants.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/models/simple_menu_model.h" | 33 #include "ui/base/models/simple_menu_model.h" |
34 #include "ui/base/text/text_elider.h" | |
35 #include "ui/gfx/font.h" | 34 #include "ui/gfx/font.h" |
36 #include "ui/gfx/gtk_util.h" | 35 #include "ui/gfx/gtk_util.h" |
| 36 #include "ui/gfx/text_elider.h" |
37 | 37 |
38 using content::PluginService; | 38 using content::PluginService; |
39 using content::WebContents; | 39 using content::WebContents; |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 // The maximum width of a title entry in the content box. We elide anything | 43 // The maximum width of a title entry in the content box. We elide anything |
44 // longer than this. | 44 // longer than this. |
45 const int kMaxLinkPixelSize = 500; | 45 const int kMaxLinkPixelSize = 500; |
46 | 46 |
47 // The minimum and maximum width of the media menu buttons. | 47 // The minimum and maximum width of the media menu buttons. |
48 const int kMinMediaMenuButtonWidth = 100; | 48 const int kMinMediaMenuButtonWidth = 100; |
49 const int kMaxMediaMenuButtonWidth = 600; | 49 const int kMaxMediaMenuButtonWidth = 600; |
50 | 50 |
51 std::string BuildElidedText(const std::string& input) { | 51 std::string BuildElidedText(const std::string& input) { |
52 return UTF16ToUTF8(ui::ElideText( | 52 return UTF16ToUTF8(gfx::ElideText( |
53 UTF8ToUTF16(input), | 53 UTF8ToUTF16(input), |
54 gfx::Font(), | 54 gfx::Font(), |
55 kMaxLinkPixelSize, | 55 kMaxLinkPixelSize, |
56 ui::ELIDE_AT_END)); | 56 gfx::ELIDE_AT_END)); |
57 } | 57 } |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 ContentSettingBubbleGtk::ContentSettingBubbleGtk( | 61 ContentSettingBubbleGtk::ContentSettingBubbleGtk( |
62 GtkWidget* anchor, | 62 GtkWidget* anchor, |
63 BubbleDelegateGtk* delegate, | 63 BubbleDelegateGtk* delegate, |
64 ContentSettingBubbleModel* content_setting_bubble_model, | 64 ContentSettingBubbleModel* content_setting_bubble_model, |
65 Profile* profile, | 65 Profile* profile, |
66 WebContents* web_contents) | 66 WebContents* web_contents) |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 GtkMediaMenuMap::iterator i(media_menus_.find(button)); | 416 GtkMediaMenuMap::iterator i(media_menus_.find(button)); |
417 DCHECK(i != media_menus_.end()); | 417 DCHECK(i != media_menus_.end()); |
418 i->second->menu->PopupForWidget(button, 1, gtk_get_current_event_time()); | 418 i->second->menu->PopupForWidget(button, 1, gtk_get_current_event_time()); |
419 } | 419 } |
420 | 420 |
421 ContentSettingBubbleGtk::MediaMenuGtk::MediaMenuGtk( | 421 ContentSettingBubbleGtk::MediaMenuGtk::MediaMenuGtk( |
422 content::MediaStreamType type) | 422 content::MediaStreamType type) |
423 : type(type) {} | 423 : type(type) {} |
424 | 424 |
425 ContentSettingBubbleGtk::MediaMenuGtk::~MediaMenuGtk() {} | 425 ContentSettingBubbleGtk::MediaMenuGtk::~MediaMenuGtk() {} |
OLD | NEW |