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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 489753002: Added proper extension manifest parser for launcher_page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Blank line. Created 6 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
« no previous file with comments | « no previous file | chrome/chrome_tests_unit.gypi » ('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/ui/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/custom_launcher_page_contents.h" 9 #include "apps/custom_launcher_page_contents.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 23 matching lines...) Expand all
34 #include "chrome/common/extensions/extension_constants.h" 34 #include "chrome/common/extensions/extension_constants.h"
35 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
36 #include "components/signin/core/browser/signin_manager.h" 36 #include "components/signin/core/browser/signin_manager.h"
37 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
38 #include "content/public/browser/page_navigator.h" 38 #include "content/public/browser/page_navigator.h"
39 #include "content/public/browser/user_metrics.h" 39 #include "content/public/browser/user_metrics.h"
40 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
41 #include "extensions/browser/extension_registry.h" 41 #include "extensions/browser/extension_registry.h"
42 #include "extensions/common/constants.h" 42 #include "extensions/common/constants.h"
43 #include "extensions/common/extension_set.h" 43 #include "extensions/common/extension_set.h"
44 #include "extensions/common/manifest.h"
45 #include "extensions/common/manifest_constants.h" 44 #include "extensions/common/manifest_constants.h"
45 #include "extensions/common/manifest_handlers/launcher_page_info.h"
46 #include "grit/theme_resources.h" 46 #include "grit/theme_resources.h"
47 #include "ui/app_list/app_list_switches.h" 47 #include "ui/app_list/app_list_switches.h"
48 #include "ui/app_list/app_list_view_delegate_observer.h" 48 #include "ui/app_list/app_list_view_delegate_observer.h"
49 #include "ui/app_list/search_box_model.h" 49 #include "ui/app_list/search_box_model.h"
50 #include "ui/app_list/speech_ui_model.h" 50 #include "ui/app_list/speech_ui_model.h"
51 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
52 #include "ui/views/controls/webview/webview.h" 52 #include "ui/views/controls/webview/webview.h"
53 53
54 #if defined(TOOLKIT_VIEWS) 54 #if defined(TOOLKIT_VIEWS)
55 #include "ui/views/controls/webview/webview.h" 55 #include "ui/views/controls/webview/webview.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 // Search the list of installed extensions for ones with 'launcher_page'. 129 // Search the list of installed extensions for ones with 'launcher_page'.
130 extensions::ExtensionRegistry* extension_registry = 130 extensions::ExtensionRegistry* extension_registry =
131 extensions::ExtensionRegistry::Get(browser_context); 131 extensions::ExtensionRegistry::Get(browser_context);
132 const extensions::ExtensionSet& enabled_extensions = 132 const extensions::ExtensionSet& enabled_extensions =
133 extension_registry->enabled_extensions(); 133 extension_registry->enabled_extensions();
134 for (extensions::ExtensionSet::const_iterator it = enabled_extensions.begin(); 134 for (extensions::ExtensionSet::const_iterator it = enabled_extensions.begin();
135 it != enabled_extensions.end(); 135 it != enabled_extensions.end();
136 ++it) { 136 ++it) {
137 const extensions::Extension* extension = it->get(); 137 const extensions::Extension* extension = it->get();
138 const extensions::Manifest* manifest = extension->manifest(); 138 extensions::LauncherPageInfo* info =
139 if (!manifest->HasKey(extensions::manifest_keys::kLauncherPage)) 139 extensions::LauncherPageHandler::GetInfo(extension);
140 if (!info)
140 continue; 141 continue;
141 std::string launcher_page_page; 142
142 if (!manifest->GetString(extensions::manifest_keys::kLauncherPagePage, 143 urls->push_back(extension->GetResourceURL(info->page));
143 &launcher_page_page)) {
144 // TODO(mgiuca): Add a proper manifest parser to catch this error properly
145 // and display it on the extensions page.
146 LOG(ERROR) << "Extension " << extension->id() << ": "
147 << extensions::manifest_keys::kLauncherPage
148 << " has no 'page' attribute; will be ignored.";
149 continue;
150 }
151 urls->push_back(extension->GetResourceURL(launcher_page_page));
152 } 144 }
153 } 145 }
154 146
155 } // namespace 147 } // namespace
156 148
157 AppListViewDelegate::AppListViewDelegate(Profile* profile, 149 AppListViewDelegate::AppListViewDelegate(Profile* profile,
158 AppListControllerDelegate* controller) 150 AppListControllerDelegate* controller)
159 : controller_(controller), 151 : controller_(controller),
160 profile_(profile), 152 profile_(profile),
161 model_(NULL), 153 model_(NULL),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 589
598 void AppListViewDelegate::AddObserver( 590 void AppListViewDelegate::AddObserver(
599 app_list::AppListViewDelegateObserver* observer) { 591 app_list::AppListViewDelegateObserver* observer) {
600 observers_.AddObserver(observer); 592 observers_.AddObserver(observer);
601 } 593 }
602 594
603 void AppListViewDelegate::RemoveObserver( 595 void AppListViewDelegate::RemoveObserver(
604 app_list::AppListViewDelegateObserver* observer) { 596 app_list::AppListViewDelegateObserver* observer) {
605 observers_.RemoveObserver(observer); 597 observers_.RemoveObserver(observer);
606 } 598 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698