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

Side by Side Diff: chrome/browser/ui/views/ash/launcher/launcher_app_tab_helper.cc

Issue 10855094: launcher: Remove old files and update DEPS whitelist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/ash/launcher/launcher_app_tab_helper.h"
6
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/tab_contents/tab_contents.h"
10 #include "chrome/common/extensions/extension.h"
11 #include "content/public/browser/web_contents.h"
12
13 namespace {
14
15 const extensions::Extension* GetExtensionForTab(Profile* profile,
16 TabContents* tab) {
17 ExtensionService* extension_service = profile->GetExtensionService();
18 if (!extension_service)
19 return NULL;
20 return extension_service->GetInstalledApp(tab->web_contents()->GetURL());
21 }
22
23 const extensions::Extension* GetExtensionByID(Profile* profile,
24 const std::string& id) {
25 ExtensionService* service = profile->GetExtensionService();
26 if (!service)
27 return NULL;
28 return service->extensions()->GetByID(id);
29 }
30
31 } // namespace
32
33 LauncherAppTabHelper::LauncherAppTabHelper(Profile* profile)
34 : profile_(profile) {
35 }
36
37 LauncherAppTabHelper::~LauncherAppTabHelper() {
38 }
39
40 std::string LauncherAppTabHelper::GetAppID(TabContents* tab) {
41 const extensions::Extension* extension = GetExtensionForTab(profile_, tab);
42 return extension ? extension->id() : std::string();
43 }
44
45 bool LauncherAppTabHelper::IsValidID(const std::string& id) {
46 return GetExtensionByID(profile_, id) != NULL;
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698