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

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

Issue 404383002: Experimental app list: custom launcher pages handle web contents events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a scoped_ptr argument. 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 | « apps/custom_launcher_page_contents.cc ('k') | no next file » | 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/metrics/user_metrics.h" 13 #include "base/metrics/user_metrics.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/profiles/profile_info_cache.h" 17 #include "chrome/browser/profiles/profile_info_cache.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/search/hotword_service.h" 19 #include "chrome/browser/search/hotword_service.h"
20 #include "chrome/browser/search/hotword_service_factory.h" 20 #include "chrome/browser/search/hotword_service_factory.h"
21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 21 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
22 #include "chrome/browser/ui/app_list/app_list_service.h" 22 #include "chrome/browser/ui/app_list/app_list_service.h"
23 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" 23 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 24 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
25 #include "chrome/browser/ui/app_list/search/search_controller.h" 25 #include "chrome/browser/ui/app_list/search/search_controller.h"
26 #include "chrome/browser/ui/app_list/start_page_service.h" 26 #include "chrome/browser/ui/app_list/start_page_service.h"
27 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
27 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/chrome_pages.h" 29 #include "chrome/browser/ui/chrome_pages.h"
29 #include "chrome/browser/ui/host_desktop.h" 30 #include "chrome/browser/ui/host_desktop.h"
30 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 31 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
31 #include "chrome/browser/web_applications/web_app.h" 32 #include "chrome/browser/web_applications/web_app.h"
32 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/extensions/extension_constants.h" 34 #include "chrome/common/extensions/extension_constants.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "components/signin/core/browser/signin_manager.h" 36 #include "components/signin/core/browser/signin_manager.h"
36 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // arbitrary extensions may be able to specify their own custom pages. 153 // arbitrary extensions may be able to specify their own custom pages.
153 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 154 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
154 if (app_list::switches::IsExperimentalAppListEnabled() && 155 if (app_list::switches::IsExperimentalAppListEnabled() &&
155 command_line->HasSwitch(switches::kCustomLauncherPage)) { 156 command_line->HasSwitch(switches::kCustomLauncherPage)) {
156 GURL custom_launcher_page_url( 157 GURL custom_launcher_page_url(
157 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage)); 158 command_line->GetSwitchValueASCII(switches::kCustomLauncherPage));
158 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) { 159 if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) {
159 LOG(ERROR) << "Invalid custom launcher page URL: " 160 LOG(ERROR) << "Invalid custom launcher page URL: "
160 << custom_launcher_page_url.possibly_invalid_spec(); 161 << custom_launcher_page_url.possibly_invalid_spec();
161 } else { 162 } else {
162 custom_page_contents_.reset(new apps::CustomLauncherPageContents()); 163 std::string extension_id = custom_launcher_page_url.host();
164 custom_page_contents_.reset(new apps::CustomLauncherPageContents(
165 scoped_ptr<apps::AppDelegate>(new ChromeAppDelegate), extension_id));
163 custom_page_contents_->Initialize(profile, custom_launcher_page_url); 166 custom_page_contents_->Initialize(profile, custom_launcher_page_url);
164 } 167 }
165 } 168 }
166 } 169 }
167 170
168 AppListViewDelegate::~AppListViewDelegate() { 171 AppListViewDelegate::~AppListViewDelegate() {
169 app_list::StartPageService* service = 172 app_list::StartPageService* service =
170 app_list::StartPageService::Get(profile_); 173 app_list::StartPageService::Get(profile_);
171 if (service) 174 if (service)
172 service->RemoveObserver(this); 175 service->RemoveObserver(this);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 532
530 void AppListViewDelegate::AddObserver( 533 void AppListViewDelegate::AddObserver(
531 app_list::AppListViewDelegateObserver* observer) { 534 app_list::AppListViewDelegateObserver* observer) {
532 observers_.AddObserver(observer); 535 observers_.AddObserver(observer);
533 } 536 }
534 537
535 void AppListViewDelegate::RemoveObserver( 538 void AppListViewDelegate::RemoveObserver(
536 app_list::AppListViewDelegateObserver* observer) { 539 app_list::AppListViewDelegateObserver* observer) {
537 observers_.RemoveObserver(observer); 540 observers_.RemoveObserver(observer);
538 } 541 }
OLDNEW
« no previous file with comments | « apps/custom_launcher_page_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698