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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/extension_utils.cc
diff --git a/chrome/browser/ui/ash/extension_utils.cc b/chrome/browser/ui/ash/extension_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b4823a30d51c5cc98ca802d960c32ee325a7ae81
--- /dev/null
+++ b/chrome/browser/ui/ash/extension_utils.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/ash/extension_utils.h"
+
+#include "chrome/browser/event_disposition.h"
+#include "chrome/browser/extensions/extension_prefs.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/extensions/application_launch.h"
+#include "chrome/common/extensions/extension.h"
+#include "googleurl/src/gurl.h"
+
+namespace extension_utils {
+
+// Opens an extension. |event_flags| holds the flags of the event
+// which invokes this extension.
+void OpenExtension(Profile* profile,
+ const extensions::Extension* extension,
+ int event_flags) {
+ DCHECK(profile);
+ DCHECK(extension);
+
+ WindowOpenDisposition disposition =
+ chrome::DispositionFromEventFlags(event_flags);
+ extension_misc::LaunchContainer container;
+
+ if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
+ container = extension_misc::LAUNCH_TAB;
+ } else if (disposition == NEW_WINDOW) {
+ container = extension_misc::LAUNCH_WINDOW;
+ } else {
+ // Look at preference to find the right launch container. If no preference
+ // is set, launch as a regular tab.
+ container =
+ profile->GetExtensionService()->extension_prefs()->GetLaunchContainer(
+ extension, extensions::ExtensionPrefs::LAUNCH_DEFAULT);
+ disposition = NEW_FOREGROUND_TAB;
+ }
+
+ application_launch::OpenApplication(application_launch::LaunchParams(
+ profile, extension, container, disposition));
+}
+
+} // namespace extension_utils

Powered by Google App Engine
This is Rietveld 408576698