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

Side by Side Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 "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
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 scoped_ptr<Event> event( 371 scoped_ptr<Event> event(
372 new Event(events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE, 372 new Event(events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE,
373 runtime::OnBrowserUpdateAvailable::kEventName, args.Pass())); 373 runtime::OnBrowserUpdateAvailable::kEventName, args.Pass()));
374 event_router->BroadcastEvent(event.Pass()); 374 event_router->BroadcastEvent(event.Pass());
375 } 375 }
376 376
377 // static 377 // static
378 void RuntimeEventRouter::DispatchOnRestartRequiredEvent( 378 void RuntimeEventRouter::DispatchOnRestartRequiredEvent(
379 content::BrowserContext* context, 379 content::BrowserContext* context,
380 const std::string& app_id, 380 const std::string& app_id,
381 core_api::runtime::OnRestartRequiredReason reason) { 381 api::runtime::OnRestartRequiredReason reason) {
382 ExtensionSystem* system = ExtensionSystem::Get(context); 382 ExtensionSystem* system = ExtensionSystem::Get(context);
383 if (!system) 383 if (!system)
384 return; 384 return;
385 385
386 scoped_ptr<Event> event( 386 scoped_ptr<Event> event(
387 new Event(events::RUNTIME_ON_RESTART_REQUIRED, 387 new Event(events::RUNTIME_ON_RESTART_REQUIRED,
388 runtime::OnRestartRequired::kEventName, 388 runtime::OnRestartRequired::kEventName,
389 core_api::runtime::OnRestartRequired::Create(reason))); 389 api::runtime::OnRestartRequired::Create(reason)));
390 EventRouter* event_router = EventRouter::Get(context); 390 EventRouter* event_router = EventRouter::Get(context);
391 DCHECK(event_router); 391 DCHECK(event_router);
392 event_router->DispatchEventToExtension(app_id, event.Pass()); 392 event_router->DispatchEventToExtension(app_id, event.Pass());
393 } 393 }
394 394
395 // static 395 // static
396 void RuntimeEventRouter::OnExtensionUninstalled( 396 void RuntimeEventRouter::OnExtensionUninstalled(
397 content::BrowserContext* context, 397 content::BrowserContext* context,
398 const std::string& extension_id, 398 const std::string& extension_id,
399 UninstallReason reason) { 399 UninstallReason reason) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 content::ChildProcessSecurityPolicy* policy = 525 content::ChildProcessSecurityPolicy* policy =
526 content::ChildProcessSecurityPolicy::GetInstance(); 526 content::ChildProcessSecurityPolicy::GetInstance();
527 policy->GrantReadFileSystem(renderer_id, filesystem_id); 527 policy->GrantReadFileSystem(renderer_id, filesystem_id);
528 base::DictionaryValue* dict = new base::DictionaryValue(); 528 base::DictionaryValue* dict = new base::DictionaryValue();
529 dict->SetString("fileSystemId", filesystem_id); 529 dict->SetString("fileSystemId", filesystem_id);
530 dict->SetString("baseName", relative_path); 530 dict->SetString("baseName", relative_path);
531 return RespondNow(OneArgument(dict)); 531 return RespondNow(OneArgument(dict));
532 } 532 }
533 533
534 } // namespace extensions 534 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/runtime/runtime_api.h ('k') | extensions/browser/api/runtime/runtime_api_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698