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

Unified Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 352033002: Added --custom-launcher-page. Adds a page to the experimental launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ash_shell build. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_list_view_delegate.cc
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
index 2195fe6a2740a74d7c314e9933343203f2c188d5..7af49bd8ab2e09fe566580e2dec68b9d91ad378a 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/metrics/user_metrics.h"
#include "base/stl_util.h"
@@ -27,19 +28,23 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/browser/web_applications/web_app.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/common/constants.h"
#include "grit/theme_resources.h"
#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/app_list_view_delegate_observer.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/speech_ui_model.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/views/controls/webview/webview.h"
#if defined(TOOLKIT_VIEWS)
#include "ui/views/controls/webview/webview.h"
@@ -144,6 +149,28 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile,
OnProfileChanged(); // sets model_
if (service)
service->AddObserver(this);
+
+ // Set up the custom launcher page. There is currently only a single custom
+ // page allowed, which is specified as a command-line flag. In the future,
+ // arbitrary extensions may be able to specify their own custom pages.
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (app_list::switches::IsExperimentalAppListEnabled() &&
+ command_line->HasSwitch(switches::kCustomLauncherPage)) {
+ GURL custom_launcher_page_url(
+ command_line->GetSwitchValueASCII(switches::kCustomLauncherPage));
+ if (!custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) {
+ LOG(ERROR) << "Invalid custom launcher page URL: "
+ << custom_launcher_page_url.possibly_invalid_spec();
+ } else {
+ content::WebContents::CreateParams params(profile_);
+ custom_page_web_contents_.reset(content::WebContents::Create(params));
+ custom_page_web_contents_->GetController().LoadURL(
+ custom_launcher_page_url,
+ content::Referrer(),
+ content::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ std::string());
+ }
+ }
}
AppListViewDelegate::~AppListViewDelegate() {
@@ -451,6 +478,18 @@ views::View* AppListViewDelegate::CreateStartPageWebView(
web_view->SetWebContents(web_contents);
return web_view;
}
+
+views::View* AppListViewDelegate::CreateCustomPageWebView(
+ const gfx::Size& size) {
+ if (!custom_page_web_contents_)
+ return NULL;
+
+ views::WebView* web_view = new views::WebView(
+ custom_page_web_contents_->GetBrowserContext());
+ web_view->SetPreferredSize(size);
+ web_view->SetWebContents(custom_page_web_contents_.get());
+ return web_view;
+}
#endif
bool AppListViewDelegate::IsSpeechRecognitionEnabled() {
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698