Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/ui/gtk/content_setting_bubble_gtk.cc

Issue 10918275: [gtk] website settings bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slightly simpler drawing Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
26 #include "ui/base/gtk/gtk_hig_constants.h" 26 #include "ui/base/gtk/gtk_hig_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/text/text_elider.h" 28 #include "ui/base/text/text_elider.h"
29 #include "ui/gfx/gtk_util.h" 29 #include "ui/gfx/gtk_util.h"
30 30
31 using content::PluginService; 31 using content::PluginService;
32 using content::WebContents; 32 using content::WebContents;
33 33
34 namespace { 34 namespace {
35 35
36 // Padding between content and edge of bubble.
37 const int kContentBorder = 7;
38
39 // The maximum width of a title entry in the content box. We elide anything 36 // The maximum width of a title entry in the content box. We elide anything
40 // longer than this. 37 // longer than this.
41 const int kMaxLinkPixelSize = 500; 38 const int kMaxLinkPixelSize = 500;
42 39
43 std::string BuildElidedText(const std::string& input) { 40 std::string BuildElidedText(const std::string& input) {
44 return UTF16ToUTF8(ui::ElideText( 41 return UTF16ToUTF8(ui::ElideText(
45 UTF8ToUTF16(input), 42 UTF8ToUTF16(input),
46 gfx::Font(), 43 gfx::Font(),
47 kMaxLinkPixelSize, 44 kMaxLinkPixelSize,
48 ui::ELIDE_AT_END)); 45 ui::ELIDE_AT_END));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const content::NotificationDetails& details) { 84 const content::NotificationDetails& details) {
88 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); 85 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED);
89 DCHECK(source == content::Source<WebContents>(web_contents_)); 86 DCHECK(source == content::Source<WebContents>(web_contents_));
90 web_contents_ = NULL; 87 web_contents_ = NULL;
91 } 88 }
92 89
93 void ContentSettingBubbleGtk::BuildBubble() { 90 void ContentSettingBubbleGtk::BuildBubble() {
94 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); 91 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_);
95 92
96 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing); 93 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing);
97 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); 94 gtk_container_set_border_width(GTK_CONTAINER(bubble_content),
95 ui::kContentAreaBorder);
98 96
99 const ContentSettingBubbleModel::BubbleContent& content = 97 const ContentSettingBubbleModel::BubbleContent& content =
100 content_setting_bubble_model_->bubble_content(); 98 content_setting_bubble_model_->bubble_content();
101 if (!content.title.empty()) { 99 if (!content.title.empty()) {
102 // Add the content label. 100 // Add the content label.
103 GtkWidget* label = gtk_label_new(content.title.c_str()); 101 GtkWidget* label = gtk_label_new(content.title.c_str());
104 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 102 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
105 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0); 103 gtk_box_pack_start(GTK_BOX(bubble_content), label, FALSE, FALSE, 0);
106 } 104 }
107 105
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 308
311 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { 309 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) {
312 content_setting_bubble_model_->OnCustomLinkClicked(); 310 content_setting_bubble_model_->OnCustomLinkClicked();
313 Close(); 311 Close();
314 } 312 }
315 313
316 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { 314 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) {
317 content_setting_bubble_model_->OnManageLinkClicked(); 315 content_setting_bubble_model_->OnManageLinkClicked();
318 Close(); 316 Close();
319 } 317 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bubble/bubble_gtk.cc ('k') | chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698