OLD | NEW |
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 "extensions/browser/api/runtime/runtime_api.h" | 5 #include "extensions/browser/api/runtime/runtime_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
34 #include "extensions/common/manifest_handlers/background_info.h" | 34 #include "extensions/common/manifest_handlers/background_info.h" |
35 #include "extensions/common/manifest_handlers/shared_module_info.h" | 35 #include "extensions/common/manifest_handlers/shared_module_info.h" |
36 #include "storage/browser/fileapi/isolated_context.h" | 36 #include "storage/browser/fileapi/isolated_context.h" |
37 #include "url/gurl.h" | 37 #include "url/gurl.h" |
38 | 38 |
39 using content::BrowserContext; | 39 using content::BrowserContext; |
40 | 40 |
41 namespace extensions { | 41 namespace extensions { |
42 | 42 |
43 namespace runtime = core_api::runtime; | 43 namespace runtime = api::runtime; |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 const char kNoBackgroundPageError[] = "You do not have a background page."; | 47 const char kNoBackgroundPageError[] = "You do not have a background page."; |
48 const char kPageLoadError[] = "Background page failed to load."; | 48 const char kPageLoadError[] = "Background page failed to load."; |
49 const char kFailedToCreateOptionsPage[] = "Could not create an options page."; | 49 const char kFailedToCreateOptionsPage[] = "Could not create an options page."; |
50 const char kInstallId[] = "id"; | 50 const char kInstallId[] = "id"; |
51 const char kInstallReason[] = "reason"; | 51 const char kInstallReason[] = "reason"; |
52 const char kInstallReasonChromeUpdate[] = "chrome_update"; | 52 const char kInstallReasonChromeUpdate[] = "chrome_update"; |
53 const char kInstallReasonUpdate[] = "update"; | 53 const char kInstallReasonUpdate[] = "update"; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 scoped_ptr<Event> event( | 368 scoped_ptr<Event> event( |
369 new Event(events::UNKNOWN, runtime::OnBrowserUpdateAvailable::kEventName, | 369 new Event(events::UNKNOWN, runtime::OnBrowserUpdateAvailable::kEventName, |
370 args.Pass())); | 370 args.Pass())); |
371 event_router->BroadcastEvent(event.Pass()); | 371 event_router->BroadcastEvent(event.Pass()); |
372 } | 372 } |
373 | 373 |
374 // static | 374 // static |
375 void RuntimeEventRouter::DispatchOnRestartRequiredEvent( | 375 void RuntimeEventRouter::DispatchOnRestartRequiredEvent( |
376 content::BrowserContext* context, | 376 content::BrowserContext* context, |
377 const std::string& app_id, | 377 const std::string& app_id, |
378 core_api::runtime::OnRestartRequiredReason reason) { | 378 api::runtime::OnRestartRequiredReason reason) { |
379 ExtensionSystem* system = ExtensionSystem::Get(context); | 379 ExtensionSystem* system = ExtensionSystem::Get(context); |
380 if (!system) | 380 if (!system) |
381 return; | 381 return; |
382 | 382 |
383 scoped_ptr<Event> event( | 383 scoped_ptr<Event> event( |
384 new Event(events::UNKNOWN, runtime::OnRestartRequired::kEventName, | 384 new Event(events::UNKNOWN, runtime::OnRestartRequired::kEventName, |
385 core_api::runtime::OnRestartRequired::Create(reason))); | 385 api::runtime::OnRestartRequired::Create(reason))); |
386 EventRouter* event_router = EventRouter::Get(context); | 386 EventRouter* event_router = EventRouter::Get(context); |
387 DCHECK(event_router); | 387 DCHECK(event_router); |
388 event_router->DispatchEventToExtension(app_id, event.Pass()); | 388 event_router->DispatchEventToExtension(app_id, event.Pass()); |
389 } | 389 } |
390 | 390 |
391 // static | 391 // static |
392 void RuntimeEventRouter::OnExtensionUninstalled( | 392 void RuntimeEventRouter::OnExtensionUninstalled( |
393 content::BrowserContext* context, | 393 content::BrowserContext* context, |
394 const std::string& extension_id, | 394 const std::string& extension_id, |
395 UninstallReason reason) { | 395 UninstallReason reason) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 content::ChildProcessSecurityPolicy* policy = | 521 content::ChildProcessSecurityPolicy* policy = |
522 content::ChildProcessSecurityPolicy::GetInstance(); | 522 content::ChildProcessSecurityPolicy::GetInstance(); |
523 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 523 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
524 base::DictionaryValue* dict = new base::DictionaryValue(); | 524 base::DictionaryValue* dict = new base::DictionaryValue(); |
525 dict->SetString("fileSystemId", filesystem_id); | 525 dict->SetString("fileSystemId", filesystem_id); |
526 dict->SetString("baseName", relative_path); | 526 dict->SetString("baseName", relative_path); |
527 return RespondNow(OneArgument(dict)); | 527 return RespondNow(OneArgument(dict)); |
528 } | 528 } |
529 | 529 |
530 } // namespace extensions | 530 } // namespace extensions |
OLD | NEW |