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

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 935893002: Don't show launcher or chrome://apps after adding a bookmark app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/bookmark_app_helper.h" 5 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 creation_locations.in_quick_launch_bar = true; 439 creation_locations.in_quick_launch_bar = true;
440 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, 440 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER,
441 creation_locations, current_profile, extension); 441 creation_locations, current_profile, extension);
442 #if defined(USE_ASH) 442 #if defined(USE_ASH)
443 } else { 443 } else {
444 ChromeLauncherController::instance()->PinAppWithID(extension->id()); 444 ChromeLauncherController::instance()->PinAppWithID(extension->id());
445 #endif 445 #endif
446 } 446 }
447 #endif 447 #endif
448 448
449 // Show the newly installed app in the app launcher, in finder (on Mac) or
450 // chrome://apps.
451 if (IsAppLauncherEnabled()) {
452 AppListService::Get(desktop)
453 ->ShowForAppInstall(current_profile, extension->id(), false);
454 #if defined(OS_MACOSX) 449 #if defined(OS_MACOSX)
455 } else if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 450 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
456 switches::kDisableHostedAppShimCreation)) { 451 switches::kDisableHostedAppShimCreation)) {
457 web_app::RevealAppShimInFinderForApp(profile_, extension); 452 web_app::RevealAppShimInFinderForApp(profile_, extension);
453 }
458 #endif 454 #endif
459 } else {
460 chrome::NavigateParams params(current_profile,
461 GURL(chrome::kChromeUIAppsURL),
462 ui::PAGE_TRANSITION_LINK);
463 params.disposition = SINGLETON_TAB;
464 chrome::Navigate(&params);
465
466 content::NotificationService::current()->Notify(
467 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
468 content::Source<content::WebContents>(params.target_contents),
469 content::Details<const std::string>(&extension->id()));
470 }
471
472 callback_.Run(extension, web_app_info_);
jackhou1 2015/02/18 02:56:10 I think you still need to call this.
benwells 2015/02/18 03:10:44 Done.
473 } 455 }
474 456
475 void BookmarkAppHelper::Observe(int type, 457 void BookmarkAppHelper::Observe(int type,
476 const content::NotificationSource& source, 458 const content::NotificationSource& source,
477 const content::NotificationDetails& details) { 459 const content::NotificationDetails& details) {
478 switch (type) { 460 switch (type) {
479 case extensions::NOTIFICATION_CRX_INSTALLER_DONE: { 461 case extensions::NOTIFICATION_CRX_INSTALLER_DONE: {
480 const Extension* extension = 462 const Extension* extension =
481 content::Details<const Extension>(details).ptr(); 463 content::Details<const Extension>(details).ptr();
482 DCHECK(extension); 464 DCHECK(extension);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 524 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
543 } 525 }
544 526
545 bool IsValidBookmarkAppUrl(const GURL& url) { 527 bool IsValidBookmarkAppUrl(const GURL& url) {
546 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); 528 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes);
547 origin_only_pattern.SetMatchAllURLs(true); 529 origin_only_pattern.SetMatchAllURLs(true);
548 return url.is_valid() && origin_only_pattern.MatchesURL(url); 530 return url.is_valid() && origin_only_pattern.MatchesURL(url);
549 } 531 }
550 532
551 } // namespace extensions 533 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698