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

Side by Side Diff: chrome/browser/ui/ash/extension_utils.cc

Issue 10828151: chrome: Copy app_list files from views/ to ash/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/ash/extension_utils.h"
6
7 #include "chrome/browser/event_disposition.h"
8 #include "chrome/browser/extensions/extension_prefs.h"
9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/extensions/application_launch.h"
12 #include "chrome/common/extensions/extension.h"
13 #include "googleurl/src/gurl.h"
14
15 namespace extension_utils {
16
17 // Opens an extension. |event_flags| holds the flags of the event
18 // which invokes this extension.
19 void OpenExtension(Profile* profile,
20 const extensions::Extension* extension,
21 int event_flags) {
22 DCHECK(profile);
23 DCHECK(extension);
24
25 WindowOpenDisposition disposition =
26 chrome::DispositionFromEventFlags(event_flags);
27 extension_misc::LaunchContainer container;
28
29 if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
30 container = extension_misc::LAUNCH_TAB;
31 } else if (disposition == NEW_WINDOW) {
32 container = extension_misc::LAUNCH_WINDOW;
33 } else {
34 // Look at preference to find the right launch container. If no preference
35 // is set, launch as a regular tab.
36 container =
37 profile->GetExtensionService()->extension_prefs()->GetLaunchContainer(
38 extension, extensions::ExtensionPrefs::LAUNCH_DEFAULT);
39 disposition = NEW_FOREGROUND_TAB;
40 }
41
42 application_launch::OpenApplication(application_launch::LaunchParams(
43 profile, extension, container, disposition));
44 }
45
46 } // namespace extension_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698