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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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 (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 extensions::Extension* GetTerminalExtension(Profile* profile) {
16 // Search order for terminal extensions. 16 // Search order for terminal extensions.
17 // We prefer hterm-dev, then hterm, then the builtin crosh extension. 17 // We prefer hterm-dev, then hterm, then the builtin crosh extension.
18 static const char* kPossibleAppIds[] = { 18 static const char* kPossibleAppIds[] = {
19 extension_misc::kHTermDevAppId, 19 extension_misc::kHTermDevAppId,
20 extension_misc::kHTermAppId, 20 extension_misc::kHTermAppId,
21 extension_misc::kCroshBuiltinAppId, 21 extension_misc::kCroshBuiltinAppId,
22 }; 22 };
23 23
24 // The hterm-dev should be first in the list. 24 // The hterm-dev should be first in the list.
25 DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermDevAppId); 25 DCHECK_EQ(kPossibleAppIds[0], extension_misc::kHTermDevAppId);
26 26
27 ExtensionService* service = profile->GetExtensionService(); 27 ExtensionService* service = profile->GetExtensionService();
28 for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) { 28 for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) {
29 const Extension* extension = service->GetExtensionById( 29 const extensions::Extension* extension = service->GetExtensionById(
30 kPossibleAppIds[x], false); 30 kPossibleAppIds[x], false);
31 if (extension) 31 if (extension)
32 return extension; 32 return extension;
33 } 33 }
34 34
35 return NULL; 35 return NULL;
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) { 40 GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) {
41 const Extension* extension = GetTerminalExtension(profile); 41 const extensions::Extension* extension = GetTerminalExtension(profile);
42 if (!extension) 42 if (!extension)
43 return GURL(); 43 return GURL();
44 44
45 return extension->GetResourceURL(kCroshExtensionEntryPoint); 45 return extension->GetResourceURL(kCroshExtensionEntryPoint);
46 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698