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

Side by Side Diff: apps/shell/browser/shell_extension_system.cc

Issue 171523005: BACKUP: NativeAppWindowView - before splitting CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/shell/browser/shell_extension_system.h" 5 #include "apps/shell/browser/shell_extension_system.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "apps/app_window_registry.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/common/extensions/extension_file_util.h" 13 #include "chrome/common/extensions/extension_file_util.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
18 #include "extensions/browser/event_router.h" 19 #include "extensions/browser/event_router.h"
(...skipping 22 matching lines...) Expand all
41 scoped_refptr<Extension> extension = 42 scoped_refptr<Extension> extension =
42 extension_file_util::LoadExtension(app_dir, 43 extension_file_util::LoadExtension(app_dir,
43 extensions::Manifest::COMMAND_LINE, 44 extensions::Manifest::COMMAND_LINE,
44 Extension::NO_FLAGS, 45 Extension::NO_FLAGS,
45 &load_error); 46 &load_error);
46 if (!extension) { 47 if (!extension) {
47 LOG(ERROR) << "Loading extension at " << app_dir.value() 48 LOG(ERROR) << "Loading extension at " << app_dir.value()
48 << " failed with: " << load_error; 49 << " failed with: " << load_error;
49 return false; 50 return false;
50 } 51 }
52 app_id_ = extension->id();
51 53
52 // TODO(jamescook): We may want to do some of these things here: 54 // TODO(jamescook): We may want to do some of these things here:
53 // * Create a PermissionsUpdater. 55 // * Create a PermissionsUpdater.
54 // * Call PermissionsUpdater::GrantActivePermissions(). 56 // * Call PermissionsUpdater::GrantActivePermissions().
55 // * Call ExtensionService::SatisfyImports(). 57 // * Call ExtensionService::SatisfyImports().
56 // * Call ExtensionPrefs::OnExtensionInstalled(). 58 // * Call ExtensionPrefs::OnExtensionInstalled().
57 // * Send NOTIFICATION_EXTENSION_INSTALLED. 59 // * Send NOTIFICATION_EXTENSION_INSTALLED.
58 60
59 ExtensionRegistry::Get(browser_context_)->AddEnabled(extension); 61 ExtensionRegistry::Get(browser_context_)->AddEnabled(extension);
60 62
(...skipping 18 matching lines...) Expand all
79 launch_data->SetBoolean("isKioskSession", false); 81 launch_data->SetBoolean("isKioskSession", false);
80 scoped_ptr<base::ListValue> event_args(new base::ListValue()); 82 scoped_ptr<base::ListValue> event_args(new base::ListValue());
81 event_args->Append(launch_data.release()); 83 event_args->Append(launch_data.release());
82 scoped_ptr<Event> event( 84 scoped_ptr<Event> event(
83 new Event("app.runtime.onLaunched", event_args.Pass())); 85 new Event("app.runtime.onLaunched", event_args.Pass()));
84 event_router_->DispatchEventWithLazyListener(extension->id(), event.Pass()); 86 event_router_->DispatchEventWithLazyListener(extension->id(), event.Pass());
85 87
86 return true; 88 return true;
87 } 89 }
88 90
91 void ShellExtensionSystem::CloseApp() {
92 apps::AppWindowRegistry::Get(browser_context_)
93 ->CloseAllAppWindowsForApp(app_id_);
94 }
95
89 void ShellExtensionSystem::Shutdown() { 96 void ShellExtensionSystem::Shutdown() {
90 } 97 }
91 98
92 void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) { 99 void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
93 runtime_data_.reset( 100 runtime_data_.reset(
94 new RuntimeData(ExtensionRegistry::Get(browser_context_))); 101 new RuntimeData(ExtensionRegistry::Get(browser_context_)));
95 lazy_background_task_queue_.reset( 102 lazy_background_task_queue_.reset(
96 new LazyBackgroundTaskQueue(browser_context_)); 103 new LazyBackgroundTaskQueue(browser_context_));
97 event_router_.reset( 104 event_router_.reset(
98 new EventRouter(browser_context_, ExtensionPrefs::Get(browser_context_))); 105 new EventRouter(browser_context_, ExtensionPrefs::Get(browser_context_)));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts( 181 void ShellExtensionSystem::UnregisterExtensionWithRequestContexts(
175 const std::string& extension_id, 182 const std::string& extension_id,
176 const UnloadedExtensionInfo::Reason reason) { 183 const UnloadedExtensionInfo::Reason reason) {
177 } 184 }
178 185
179 const OneShotEvent& ShellExtensionSystem::ready() const { 186 const OneShotEvent& ShellExtensionSystem::ready() const {
180 return ready_; 187 return ready_;
181 } 188 }
182 189
183 } // namespace extensions 190 } // namespace extensions
OLDNEW
« no previous file with comments | « apps/shell/browser/shell_extension_system.h ('k') | apps/shell/browser/shell_native_app_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698