| 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/script_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/script_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_system.h" | 13 #include "chrome/browser/extensions/extension_system.h" |
| 14 #include "chrome/browser/extensions/image_loader.h" | 14 #include "chrome/browser/extensions/image_loader.h" |
| 15 #include "chrome/browser/extensions/script_bubble_controller.h" | 15 #include "chrome/browser/extensions/script_bubble_controller.h" |
| 16 #include "chrome/browser/extensions/tab_helper.h" | 16 #include "chrome/browser/extensions/tab_helper.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 19 #include "chrome/common/extensions/extension_set.h" | |
| 20 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 19 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 21 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 22 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 23 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
| 23 #include "extensions/common/extension_set.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
| 26 #include "grit/ui_resources.h" | 26 #include "grit/ui_resources.h" |
| 27 #include "ui/base/gtk/gtk_hig_constants.h" | 27 #include "ui/base/gtk/gtk_hig_constants.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 | 29 |
| 30 using content::WebContents; | 30 using content::WebContents; |
| 31 using content::OpenURLParams; | 31 using content::OpenURLParams; |
| 32 using content::Referrer; | 32 using content::Referrer; |
| 33 using extensions::Extension; | 33 using extensions::Extension; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); | 81 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); |
| 82 | 82 |
| 83 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing); | 83 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 84 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), | 84 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), |
| 85 ui::kContentAreaBorder); | 85 ui::kContentAreaBorder); |
| 86 | 86 |
| 87 extensions::TabHelper* tab_helper = | 87 extensions::TabHelper* tab_helper = |
| 88 extensions::TabHelper::FromWebContents(web_contents_); | 88 extensions::TabHelper::FromWebContents(web_contents_); |
| 89 const std::set<std::string>& extensions_running_scripts = | 89 const std::set<std::string>& extensions_running_scripts = |
| 90 tab_helper->script_bubble_controller()->extensions_running_scripts(); | 90 tab_helper->script_bubble_controller()->extensions_running_scripts(); |
| 91 const ExtensionSet* loaded_extensions = | 91 const extensions::ExtensionSet* loaded_extensions = |
| 92 ExtensionSystem::Get(profile_)->extension_service()->extensions(); | 92 ExtensionSystem::Get(profile_)->extension_service()->extensions(); |
| 93 | 93 |
| 94 std::string heading_string = | 94 std::string heading_string = |
| 95 l10n_util::GetStringUTF8(IDS_SCRIPT_BUBBLE_HEADLINE); | 95 l10n_util::GetStringUTF8(IDS_SCRIPT_BUBBLE_HEADLINE); |
| 96 GtkWidget* heading = gtk_label_new(heading_string.c_str()); | 96 GtkWidget* heading = gtk_label_new(heading_string.c_str()); |
| 97 gtk_misc_set_alignment(GTK_MISC(heading), 0, 0); | 97 gtk_misc_set_alignment(GTK_MISC(heading), 0, 0); |
| 98 gtk_box_pack_start(GTK_BOX(bubble_content), heading, FALSE, FALSE, 0); | 98 gtk_box_pack_start(GTK_BOX(bubble_content), heading, FALSE, FALSE, 0); |
| 99 | 99 |
| 100 for (std::set<std::string>::const_iterator iter = | 100 for (std::set<std::string>::const_iterator iter = |
| 101 extensions_running_scripts.begin(); | 101 extensions_running_scripts.begin(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void ScriptBubbleGtk::OnItemLinkClicked(GtkWidget* button) { | 156 void ScriptBubbleGtk::OnItemLinkClicked(GtkWidget* button) { |
| 157 std::string link(chrome::kChromeUIExtensionsURL); | 157 std::string link(chrome::kChromeUIExtensionsURL); |
| 158 link += "?id=" + link_controls_[button]; | 158 link += "?id=" + link_controls_[button]; |
| 159 web_contents_->OpenURL(OpenURLParams(GURL(link), | 159 web_contents_->OpenURL(OpenURLParams(GURL(link), |
| 160 Referrer(), | 160 Referrer(), |
| 161 NEW_FOREGROUND_TAB, | 161 NEW_FOREGROUND_TAB, |
| 162 content::PAGE_TRANSITION_LINK, | 162 content::PAGE_TRANSITION_LINK, |
| 163 false)); | 163 false)); |
| 164 Close(); | 164 Close(); |
| 165 } | 165 } |
| OLD | NEW |