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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble.cc

Issue 11820041: Remove profile-keyed factory boilerplates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 11 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/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"
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/extensions/extension_install_ui.h" 17 #include "chrome/browser/extensions/extension_install_ui.h"
19 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/browser/ui/singleton_tabs.h" 21 #include "chrome/browser/ui/singleton_tabs.h"
23 #include "chrome/browser/ui/views/browser_action_view.h" 22 #include "chrome/browser/ui/views/browser_action_view.h"
24 #include "chrome/browser/ui/views/browser_actions_container.h" 23 #include "chrome/browser/ui/views/browser_actions_container.h"
25 #include "chrome/browser/ui/views/frame/browser_view.h" 24 #include "chrome/browser/ui/views/frame/browser_view.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 143 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
145 heading_->SetMultiLine(true); 144 heading_->SetMultiLine(true);
146 heading_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 145 heading_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
147 AddChildView(heading_); 146 AddChildView(heading_);
148 147
149 bool has_keybinding = false; 148 bool has_keybinding = false;
150 149
151 switch (type_) { 150 switch (type_) {
152 case ExtensionInstalledBubble::BROWSER_ACTION: { 151 case ExtensionInstalledBubble::BROWSER_ACTION: {
153 extensions::CommandService* command_service = 152 extensions::CommandService* command_service =
154 extensions::CommandServiceFactory::GetForProfile( 153 extensions::CommandService::Get(browser_->profile());
155 browser_->profile());
156 extensions::Command browser_action_command; 154 extensions::Command browser_action_command;
157 if (!command_service->GetBrowserActionCommand( 155 if (!command_service->GetBrowserActionCommand(
158 extension->id(), 156 extension->id(),
159 extensions::CommandService::ACTIVE_ONLY, 157 extensions::CommandService::ACTIVE_ONLY,
160 &browser_action_command, 158 &browser_action_command,
161 NULL)) { 159 NULL)) {
162 info_ = new views::Label(l10n_util::GetStringUTF16( 160 info_ = new views::Label(l10n_util::GetStringUTF16(
163 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 161 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
164 } else { 162 } else {
165 has_keybinding = true; 163 has_keybinding = true;
166 info_ = new views::Label(l10n_util::GetStringFUTF16( 164 info_ = new views::Label(l10n_util::GetStringFUTF16(
167 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 165 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
168 browser_action_command.accelerator().GetShortcutText())); 166 browser_action_command.accelerator().GetShortcutText()));
169 } 167 }
170 168
171 info_->SetFont(font); 169 info_->SetFont(font);
172 info_->SetMultiLine(true); 170 info_->SetMultiLine(true);
173 info_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 171 info_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
174 AddChildView(info_); 172 AddChildView(info_);
175 173
176 manage_shortcut_ = new views::Link( 174 manage_shortcut_ = new views::Link(
177 l10n_util::GetStringUTF16( 175 l10n_util::GetStringUTF16(
178 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); 176 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
179 break; 177 break;
180 } 178 }
181 case ExtensionInstalledBubble::PAGE_ACTION: { 179 case ExtensionInstalledBubble::PAGE_ACTION: {
182 extensions::CommandService* command_service = 180 extensions::CommandService* command_service =
183 extensions::CommandServiceFactory::GetForProfile( 181 extensions::CommandService::Get(browser_->profile());
184 browser_->profile());
185 extensions::Command page_action_command; 182 extensions::Command page_action_command;
186 if (!command_service->GetPageActionCommand( 183 if (!command_service->GetPageActionCommand(
187 extension->id(), 184 extension->id(),
188 extensions::CommandService::ACTIVE_ONLY, 185 extensions::CommandService::ACTIVE_ONLY,
189 &page_action_command, 186 &page_action_command,
190 NULL)) { 187 NULL)) {
191 info_ = new views::Label(l10n_util::GetStringUTF16( 188 info_ = new views::Label(l10n_util::GetStringUTF16(
192 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); 189 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
193 } else { 190 } else {
194 has_keybinding = true; 191 has_keybinding = true;
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 521
525 void ExtensionInstalledBubble::WindowClosing() { 522 void ExtensionInstalledBubble::WindowClosing() {
526 if (extension_ && type_ == PAGE_ACTION) { 523 if (extension_ && type_ == PAGE_ACTION) {
527 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 524 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
528 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 525 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
529 extensions::ExtensionActionManager::Get(browser_->profile())-> 526 extensions::ExtensionActionManager::Get(browser_->profile())->
530 GetPageAction(*extension_), 527 GetPageAction(*extension_),
531 false); // preview_enabled 528 false); // preview_enabled
532 } 529 }
533 } 530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698