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

Side by Side Diff: chrome/browser/apps/install_chrome_app.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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 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/apps/install_chrome_app.h" 5 #include "chrome/browser/apps/install_chrome_app.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void InstallChromeApp(const std::string& app_id) { 76 void InstallChromeApp(const std::string& app_id) {
77 if (!crx_file::id_util::IdIsValid(app_id)) 77 if (!crx_file::id_util::IdIsValid(app_id))
78 return; 78 return;
79 79
80 // At the moment InstallChromeApp() is called immediately after handling 80 // At the moment InstallChromeApp() is called immediately after handling
81 // startup URLs, so a browser is guaranteed to be created. If that changes we 81 // startup URLs, so a browser is guaranteed to be created. If that changes we
82 // may need to start a browser or browser session here. 82 // may need to start a browser or browser session here.
83 Browser* browser = BrowserList::GetInstance()->get(0); 83 Browser* browser = BrowserList::GetInstance()->get(0);
84 DCHECK(browser); 84 DCHECK(browser);
85 85
86 content::OpenURLParams params(GetAppInstallUrl(app_id), 86 content::OpenURLParams params(GetAppInstallUrl(app_id), content::Referrer(),
87 content::Referrer(), 87 WindowOpenDisposition::NEW_FOREGROUND_TAB,
88 NEW_FOREGROUND_TAB, 88 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false);
89 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
90 false);
91 browser->OpenURL(params); 89 browser->OpenURL(params);
92 90
93 ExtensionRegistry* registry = ExtensionRegistry::Get(browser->profile()); 91 ExtensionRegistry* registry = ExtensionRegistry::Get(browser->profile());
94 // Skip if this app is already installed or blacklisted. For disabled or 92 // Skip if this app is already installed or blacklisted. For disabled or
95 // or terminated apps, going through the installation flow should re-enable 93 // or terminated apps, going through the installation flow should re-enable
96 // them. 94 // them.
97 const extensions::Extension* installed_extension = registry->GetExtensionById( 95 const extensions::Extension* installed_extension = registry->GetExtensionById(
98 app_id, ExtensionRegistry::ENABLED | ExtensionRegistry::BLACKLISTED); 96 app_id, ExtensionRegistry::ENABLED | ExtensionRegistry::BLACKLISTED);
99 // TODO(jackhou): For installed apps, maybe we should do something better, 97 // TODO(jackhou): For installed apps, maybe we should do something better,
100 // e.g. show the app list (and re-add it to the taskbar). 98 // e.g. show the app list (and re-add it to the taskbar).
101 if (installed_extension) 99 if (installed_extension)
102 return; 100 return;
103 101
104 WebstoreInstallWithPromptAppsOnly* installer = 102 WebstoreInstallWithPromptAppsOnly* installer =
105 new WebstoreInstallWithPromptAppsOnly( 103 new WebstoreInstallWithPromptAppsOnly(
106 app_id, browser->profile(), browser->window()->GetNativeWindow()); 104 app_id, browser->profile(), browser->window()->GetNativeWindow());
107 installer->BeginInstall(); 105 installer->BeginInstall();
108 } 106 }
109 107
110 } // namespace install_chrome_app 108 } // namespace install_chrome_app
OLDNEW
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | chrome/browser/autofill/autofill_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698