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

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

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Created 7 years, 9 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
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/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/api/icons/icons_handler.h"
19 #include "chrome/common/extensions/extension.h" 20 #include "chrome/common/extensions/extension.h"
20 #include "chrome/common/extensions/extension_set.h" 21 #include "chrome/common/extensions/extension_set.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
25 #include "grit/ui_resources.h" 26 #include "grit/ui_resources.h"
26 #include "ui/base/gtk/gtk_hig_constants.h" 27 #include "ui/base/gtk/gtk_hig_constants.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 29
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 gtk_box_pack_start(GTK_BOX(bubble_content), item, FALSE, FALSE, 0); 108 gtk_box_pack_start(GTK_BOX(bubble_content), item, FALSE, FALSE, 0);
108 109
109 GtkWidget* image = gtk_image_new(); 110 GtkWidget* image = gtk_image_new();
110 gtk_widget_set_usize(image, 16, 16); 111 gtk_widget_set_usize(image, 16, 16);
111 gtk_box_pack_start(GTK_BOX(item), image, FALSE, FALSE, 0); 112 gtk_box_pack_start(GTK_BOX(item), image, FALSE, FALSE, 0);
112 113
113 // Load the image asynchronously. 114 // Load the image asynchronously.
114 icon_controls_[extension->id()] = GTK_IMAGE(image); 115 icon_controls_[extension->id()] = GTK_IMAGE(image);
115 ImageLoader::Get(profile_)->LoadImageAsync( 116 ImageLoader::Get(profile_)->LoadImageAsync(
116 extension, 117 extension,
117 extension->GetIconResource(extension_misc::EXTENSION_ICON_BITTY, 118 extensions::IconsInfo::GetIconResource(
118 ExtensionIconSet::MATCH_EXACTLY), 119 extension,
120 extension_misc::EXTENSION_ICON_BITTY,
121 ExtensionIconSet::MATCH_EXACTLY),
119 gfx::Size(extension_misc::EXTENSION_ICON_BITTY, 122 gfx::Size(extension_misc::EXTENSION_ICON_BITTY,
120 extension_misc::EXTENSION_ICON_BITTY), 123 extension_misc::EXTENSION_ICON_BITTY),
121 base::Bind(&ScriptBubbleGtk::OnIconLoaded, 124 base::Bind(&ScriptBubbleGtk::OnIconLoaded,
122 weak_ptr_factory_.GetWeakPtr(), 125 weak_ptr_factory_.GetWeakPtr(),
123 extension->id())); 126 extension->id()));
124 127
125 GtkWidget* link = theme_provider->BuildChromeLinkButton( 128 GtkWidget* link = theme_provider->BuildChromeLinkButton(
126 extension->name().c_str()); 129 extension->name().c_str());
127 gtk_box_pack_start(GTK_BOX(item), link, FALSE, FALSE, 0); 130 gtk_box_pack_start(GTK_BOX(item), link, FALSE, FALSE, 0);
128 link_controls_[GTK_WIDGET(link)] = extension->id(); 131 link_controls_[GTK_WIDGET(link)] = extension->id();
(...skipping 24 matching lines...) Expand all
153 void ScriptBubbleGtk::OnItemLinkClicked(GtkWidget* button) { 156 void ScriptBubbleGtk::OnItemLinkClicked(GtkWidget* button) {
154 std::string link(chrome::kChromeUIExtensionsURL); 157 std::string link(chrome::kChromeUIExtensionsURL);
155 link += "?id=" + link_controls_[button]; 158 link += "?id=" + link_controls_[button];
156 web_contents_->OpenURL(OpenURLParams(GURL(link), 159 web_contents_->OpenURL(OpenURLParams(GURL(link),
157 Referrer(), 160 Referrer(),
158 NEW_FOREGROUND_TAB, 161 NEW_FOREGROUND_TAB,
159 content::PAGE_TRANSITION_LINK, 162 content::PAGE_TRANSITION_LINK,
160 false)); 163 false));
161 Close(); 164 Close();
162 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698