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

Side by Side Diff: chrome/browser/ui/ash/app_list/extension_app_item.cc

Issue 10825317: Convert banned calls to use Navigate in ash app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/ash/app_list/search_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ash/app_list/extension_app_item.h" 5 #include "chrome/browser/ui/ash/app_list/extension_app_item.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_prefs.h" 8 #include "chrome/browser/extensions/extension_prefs.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
12 #include "chrome/browser/extensions/management_policy.h" 12 #include "chrome/browser/extensions/management_policy.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/ash/extension_utils.h" 14 #include "chrome/browser/ui/ash/extension_utils.h"
15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/common/extensions/extension.h" 20 #include "chrome/common/extensions/extension.h"
21 #include "chrome/common/extensions/extension_icon_set.h" 21 #include "chrome/common/extensions/extension_icon_set.h"
22 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
26 26
27 using extensions::Extension; 27 using extensions::Extension;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 gfx::Size(ExtensionIconSet::EXTENSION_ICON_LARGE, 160 gfx::Size(ExtensionIconSet::EXTENSION_ICON_LARGE,
161 ExtensionIconSet::EXTENSION_ICON_LARGE), 161 ExtensionIconSet::EXTENSION_ICON_LARGE),
162 ImageLoadingTracker::DONT_CACHE); 162 ImageLoadingTracker::DONT_CACHE);
163 } 163 }
164 164
165 void ExtensionAppItem::ShowExtensionOptions() { 165 void ExtensionAppItem::ShowExtensionOptions() {
166 const Extension* extension = GetExtension(); 166 const Extension* extension = GetExtension();
167 if (!extension) 167 if (!extension)
168 return; 168 return;
169 169
170 // TODO(beng): use Navigate()! 170 chrome::NavigateParams params(profile_,
171 Browser* browser = browser::FindLastActiveWithProfile(profile_); 171 extension->options_url(),
172 if (!browser) {
173 browser = new Browser(Browser::CreateParams(profile_));
174 browser->window()->Show();
175 }
176
177 chrome::AddSelectedTabWithURL(browser, extension->options_url(),
178 content::PAGE_TRANSITION_LINK); 172 content::PAGE_TRANSITION_LINK);
179 browser->window()->Activate(); 173 chrome::Navigate(&params);
180 } 174 }
181 175
182 void ExtensionAppItem::StartExtensionUninstall() { 176 void ExtensionAppItem::StartExtensionUninstall() {
183 // ExtensionUninstall deletes itself when done or aborted. 177 // ExtensionUninstall deletes itself when done or aborted.
184 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_, 178 ExtensionUninstaller* uninstaller = new ExtensionUninstaller(profile_,
185 extension_id_); 179 extension_id_);
186 uninstaller->Run(); 180 uninstaller->Run();
187 } 181 }
188 182
189 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image, 183 void ExtensionAppItem::OnImageLoaded(const gfx::Image& image,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 LAUNCH_TYPE_FULLSCREEN, 293 LAUNCH_TYPE_FULLSCREEN,
300 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED); 294 IDS_APP_CONTEXT_MENU_OPEN_MAXIMIZED);
301 context_menu_model_->AddSeparator(); 295 context_menu_model_->AddSeparator();
302 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS); 296 context_menu_model_->AddItemWithStringId(OPTIONS, IDS_NEW_TAB_APP_OPTIONS);
303 context_menu_model_->AddItemWithStringId(UNINSTALL, 297 context_menu_model_->AddItemWithStringId(UNINSTALL,
304 IDS_EXTENSIONS_UNINSTALL); 298 IDS_EXTENSIONS_UNINSTALL);
305 } 299 }
306 300
307 return context_menu_model_.get(); 301 return context_menu_model_.get();
308 } 302 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/app_list/search_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698