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

Side by Side Diff: chrome/browser/extensions/api/terminal/terminal_extension_helper.cc

Issue 9826032: hterm: Load component-extension version of crosh+hterm (chromeos only). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add manifest.json file Created 8 years, 9 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
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/extensions/api/terminal/terminal_extension_helper.h" 5 #include "chrome/browser/extensions/api/terminal/terminal_extension_helper.h"
6 6
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 10
11 namespace { 11 namespace {
12 12
13 const char kCroshExtensionEntryPoint[] = "/html/crosh.html"; 13 const char kCroshExtensionEntryPoint[] = "/html/crosh.html";
14 14
15 const Extension* GetTerminalExtension(Profile* profile) { 15 const Extension* GetTerminalExtension(Profile* profile) {
16 // Search order for terminal extensions.
17 // We prefer hterm-dev, then hterm, then the builtin crosh extension.
16 static const char* kPossibleAppIds[] = { 18 static const char* kPossibleAppIds[] = {
19 extension_misc::kHTermDevAppId,
17 extension_misc::kHTermAppId, 20 extension_misc::kHTermAppId,
18 extension_misc::kHTermDevAppId 21 extension_misc::kCroshBuiltinAppId,
19 }; 22 };
20 23
21 // The production app should be first in the list. 24 // The hterm-dev should be first in the list.
22 DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermAppId); 25 DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermDevAppId);
23 26
24 ExtensionService* service = profile->GetExtensionService(); 27 ExtensionService* service = profile->GetExtensionService();
25 for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) { 28 for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) {
26 const Extension* extension = service->GetExtensionById( 29 const Extension* extension = service->GetExtensionById(
27 kPossibleAppIds[x], false); 30 kPossibleAppIds[x], false);
28 if (extension) 31 if (extension && service->IsExtensionEnabled(kPossibleAppIds[x]))
tonibarzic 2012/03/22 23:53:56 false in GetExtensionById(id, false) is for "inclu
rginda 2012/03/23 00:03:17 Done.
29 return extension; 32 return extension;
30 } 33 }
31 34
32 return NULL; 35 return NULL;
33 } 36 }
34 37
35 } // namespace 38 } // namespace
36 39
37 GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) { 40 GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) {
38 const Extension* extension = GetTerminalExtension(profile); 41 const Extension* extension = GetTerminalExtension(profile);
39 if (!extension) 42 if (!extension)
40 return GURL(); 43 return GURL();
41 44
42 return extension->GetResourceURL(kCroshExtensionEntryPoint); 45 return extension->GetResourceURL(kCroshExtensionEntryPoint);
43 } 46 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698