| 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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 BubbleDelegateGtk* delegate, | 51 BubbleDelegateGtk* delegate, |
| 52 ContentSettingBubbleModel* content_setting_bubble_model, | 52 ContentSettingBubbleModel* content_setting_bubble_model, |
| 53 Profile* profile, | 53 Profile* profile, |
| 54 TabContents* tab_contents) | 54 TabContents* tab_contents) |
| 55 : anchor_(anchor), | 55 : anchor_(anchor), |
| 56 profile_(profile), | 56 profile_(profile), |
| 57 tab_contents_(tab_contents), | 57 tab_contents_(tab_contents), |
| 58 delegate_(delegate), | 58 delegate_(delegate), |
| 59 content_setting_bubble_model_(content_setting_bubble_model), | 59 content_setting_bubble_model_(content_setting_bubble_model), |
| 60 bubble_(NULL) { | 60 bubble_(NULL) { |
| 61 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, | 61 registrar_.Add(this, chrome::TAB_CONTENTS_DESTROYED, |
| 62 Source<TabContents>(tab_contents)); | 62 Source<TabContents>(tab_contents)); |
| 63 BuildBubble(); | 63 BuildBubble(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ContentSettingBubbleGtk::~ContentSettingBubbleGtk() { | 66 ContentSettingBubbleGtk::~ContentSettingBubbleGtk() { |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ContentSettingBubbleGtk::Close() { | 69 void ContentSettingBubbleGtk::Close() { |
| 70 if (bubble_) | 70 if (bubble_) |
| 71 bubble_->Close(); | 71 bubble_->Close(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ContentSettingBubbleGtk::BubbleClosing(BubbleGtk* bubble, | 74 void ContentSettingBubbleGtk::BubbleClosing(BubbleGtk* bubble, |
| 75 bool closed_by_escape) { | 75 bool closed_by_escape) { |
| 76 delegate_->BubbleClosing(bubble, closed_by_escape); | 76 delegate_->BubbleClosing(bubble, closed_by_escape); |
| 77 delete this; | 77 delete this; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ContentSettingBubbleGtk::Observe(NotificationType type, | 80 void ContentSettingBubbleGtk::Observe(NotificationType type, |
| 81 const NotificationSource& source, | 81 const NotificationSource& source, |
| 82 const NotificationDetails& details) { | 82 const NotificationDetails& details) { |
| 83 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); | 83 DCHECK(type == chrome::TAB_CONTENTS_DESTROYED); |
| 84 DCHECK(source == Source<TabContents>(tab_contents_)); | 84 DCHECK(source == Source<TabContents>(tab_contents_)); |
| 85 tab_contents_ = NULL; | 85 tab_contents_ = NULL; |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ContentSettingBubbleGtk::BuildBubble() { | 88 void ContentSettingBubbleGtk::BuildBubble() { |
| 89 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); | 89 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); |
| 90 | 90 |
| 91 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 91 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
| 92 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); | 92 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); |
| 93 | 93 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 302 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
| 303 content_setting_bubble_model_->OnCustomLinkClicked(); | 303 content_setting_bubble_model_->OnCustomLinkClicked(); |
| 304 Close(); | 304 Close(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 307 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
| 308 content_setting_bubble_model_->OnManageLinkClicked(); | 308 content_setting_bubble_model_->OnManageLinkClicked(); |
| 309 Close(); | 309 Close(); |
| 310 } | 310 } |
| OLD | NEW |