| 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/views/extensions/extension_installed_bubble.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | 136 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); |
| 137 heading_->SetMultiLine(true); | 137 heading_->SetMultiLine(true); |
| 138 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 138 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 139 AddChildView(heading_); | 139 AddChildView(heading_); |
| 140 | 140 |
| 141 bool has_keybinding = false; | 141 bool has_keybinding = false; |
| 142 | 142 |
| 143 switch (type_) { | 143 switch (type_) { |
| 144 case ExtensionInstalledBubble::BROWSER_ACTION: { | 144 case ExtensionInstalledBubble::BROWSER_ACTION: { |
| 145 const Extension::ExtensionKeybinding* browser_action_command = | 145 const Extension::ExtensionKeybinding* browser_action_command = |
| 146 extension->browser_action_command(); | 146 ExtensionKeybindingRegistry::GetActiveBrowserActionCommand( |
| 147 browser_->profile(), extension->id()); |
| 147 if (!browser_action_command) { | 148 if (!browser_action_command) { |
| 148 info_ = new views::Label(l10n_util::GetStringUTF16( | 149 info_ = new views::Label(l10n_util::GetStringUTF16( |
| 149 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); | 150 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); |
| 150 } else { | 151 } else { |
| 151 has_keybinding = true; | 152 has_keybinding = true; |
| 152 info_ = new views::Label(l10n_util::GetStringFUTF16( | 153 info_ = new views::Label(l10n_util::GetStringFUTF16( |
| 153 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, | 154 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, |
| 154 browser_action_command->accelerator().GetShortcutText())); | 155 browser_action_command->accelerator().GetShortcutText())); |
| 155 } | 156 } |
| 157 |
| 156 info_->SetFont(font); | 158 info_->SetFont(font); |
| 157 info_->SetMultiLine(true); | 159 info_->SetMultiLine(true); |
| 158 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 160 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 159 AddChildView(info_); | 161 AddChildView(info_); |
| 160 break; | 162 break; |
| 161 } | 163 } |
| 162 case ExtensionInstalledBubble::PAGE_ACTION: { | 164 case ExtensionInstalledBubble::PAGE_ACTION: { |
| 163 const Extension::ExtensionKeybinding* page_action_command = | 165 const Extension::ExtensionKeybinding* page_action_command = |
| 164 extension->page_action_command(); | 166 ExtensionKeybindingRegistry::GetActivePageActionCommand( |
| 167 browser_->profile(), extension->id()); |
| 165 if (!page_action_command) { | 168 if (!page_action_command) { |
| 166 info_ = new views::Label(l10n_util::GetStringUTF16( | 169 info_ = new views::Label(l10n_util::GetStringUTF16( |
| 167 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); | 170 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); |
| 168 } else { | 171 } else { |
| 169 has_keybinding = true; | 172 has_keybinding = true; |
| 170 info_ = new views::Label(l10n_util::GetStringFUTF16( | 173 info_ = new views::Label(l10n_util::GetStringFUTF16( |
| 171 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, | 174 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, |
| 172 page_action_command->accelerator().GetShortcutText())); | 175 page_action_command->accelerator().GetShortcutText())); |
| 173 } | 176 } |
| 174 | 177 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 468 } |
| 466 | 469 |
| 467 void ExtensionInstalledBubble::WindowClosing() { | 470 void ExtensionInstalledBubble::WindowClosing() { |
| 468 if (extension_ && type_ == PAGE_ACTION) { | 471 if (extension_ && type_ == PAGE_ACTION) { |
| 469 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 472 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
| 470 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 473 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
| 471 extension_->page_action(), | 474 extension_->page_action(), |
| 472 false); // preview_enabled | 475 false); // preview_enabled |
| 473 } | 476 } |
| 474 } | 477 } |
| OLD | NEW |