| 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/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/extensions/api/commands/command_service.h" | 14 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 15 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | |
| 16 #include "chrome/browser/extensions/extension_action.h" | 15 #include "chrome/browser/extensions/extension_action.h" |
| 17 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
| 18 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_dialogs.h" | 18 #include "chrome/browser/ui/browser_dialogs.h" |
| 20 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" | 19 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
| 21 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 20 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 22 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 21 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 23 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 24 #include "chrome/browser/ui/gtk/gtk_util.h" | 23 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 25 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 24 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 g_free(markup); | 239 g_free(markup); |
| 241 | 240 |
| 242 gtk_util::SetLabelWidth(heading_label, kTextColumnWidth); | 241 gtk_util::SetLabelWidth(heading_label, kTextColumnWidth); |
| 243 gtk_box_pack_start(GTK_BOX(text_column), heading_label, FALSE, FALSE, 0); | 242 gtk_box_pack_start(GTK_BOX(text_column), heading_label, FALSE, FALSE, 0); |
| 244 | 243 |
| 245 bool has_keybinding = false; | 244 bool has_keybinding = false; |
| 246 | 245 |
| 247 // Browser action label. | 246 // Browser action label. |
| 248 if (type_ == BROWSER_ACTION) { | 247 if (type_ == BROWSER_ACTION) { |
| 249 extensions::CommandService* command_service = | 248 extensions::CommandService* command_service = |
| 250 extensions::CommandServiceFactory::GetForProfile( | 249 extensions::CommandService::Get(browser_->profile()); |
| 251 browser_->profile()); | |
| 252 extensions::Command browser_action_command; | 250 extensions::Command browser_action_command; |
| 253 GtkWidget* info_label; | 251 GtkWidget* info_label; |
| 254 if (!command_service->GetBrowserActionCommand( | 252 if (!command_service->GetBrowserActionCommand( |
| 255 extension_->id(), | 253 extension_->id(), |
| 256 extensions::CommandService::ACTIVE_ONLY, | 254 extensions::CommandService::ACTIVE_ONLY, |
| 257 &browser_action_command, | 255 &browser_action_command, |
| 258 NULL)) { | 256 NULL)) { |
| 259 info_label = gtk_label_new(l10n_util::GetStringUTF8( | 257 info_label = gtk_label_new(l10n_util::GetStringUTF8( |
| 260 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO).c_str()); | 258 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO).c_str()); |
| 261 } else { | 259 } else { |
| 262 info_label = gtk_label_new(l10n_util::GetStringFUTF8( | 260 info_label = gtk_label_new(l10n_util::GetStringFUTF8( |
| 263 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, | 261 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, |
| 264 browser_action_command.accelerator().GetShortcutText()).c_str()); | 262 browser_action_command.accelerator().GetShortcutText()).c_str()); |
| 265 has_keybinding = true; | 263 has_keybinding = true; |
| 266 } | 264 } |
| 267 gtk_util::SetLabelWidth(info_label, kTextColumnWidth); | 265 gtk_util::SetLabelWidth(info_label, kTextColumnWidth); |
| 268 gtk_box_pack_start(GTK_BOX(text_column), info_label, FALSE, FALSE, 0); | 266 gtk_box_pack_start(GTK_BOX(text_column), info_label, FALSE, FALSE, 0); |
| 269 } | 267 } |
| 270 | 268 |
| 271 // Page action label. | 269 // Page action label. |
| 272 if (type_ == PAGE_ACTION) { | 270 if (type_ == PAGE_ACTION) { |
| 273 extensions::CommandService* command_service = | 271 extensions::CommandService* command_service = |
| 274 extensions::CommandServiceFactory::GetForProfile( | 272 extensions::CommandService::Get(browser_->profile()); |
| 275 browser_->profile()); | |
| 276 extensions::Command page_action_command; | 273 extensions::Command page_action_command; |
| 277 GtkWidget* info_label; | 274 GtkWidget* info_label; |
| 278 if (!command_service->GetPageActionCommand( | 275 if (!command_service->GetPageActionCommand( |
| 279 extension_->id(), | 276 extension_->id(), |
| 280 extensions::CommandService::ACTIVE_ONLY, | 277 extensions::CommandService::ACTIVE_ONLY, |
| 281 &page_action_command, | 278 &page_action_command, |
| 282 NULL)) { | 279 NULL)) { |
| 283 info_label = gtk_label_new(l10n_util::GetStringUTF8( | 280 info_label = gtk_label_new(l10n_util::GetStringUTF8( |
| 284 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO).c_str()); | 281 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO).c_str()); |
| 285 } else { | 282 } else { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // on all references being cleared before it is destroyed. | 389 // on all references being cleared before it is destroyed. |
| 393 MessageLoopForUI::current()->PostTask( | 390 MessageLoopForUI::current()->PostTask( |
| 394 FROM_HERE, | 391 FROM_HERE, |
| 395 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 392 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
| 396 } | 393 } |
| 397 | 394 |
| 398 void ExtensionInstalledBubbleGtk::Close() { | 395 void ExtensionInstalledBubbleGtk::Close() { |
| 399 Release(); // Balanced in ctor. | 396 Release(); // Balanced in ctor. |
| 400 bubble_ = NULL; | 397 bubble_ = NULL; |
| 401 } | 398 } |
| OLD | NEW |