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

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

Issue 365013003: Experimental app list: Custom launcher pages have app APIs and style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made APIs work by introducing CustomLauncherPageContents. Created 6 years, 5 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
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 7af49bd8ab2e09fe566580e2dec68b9d91ad378a..0f96911f25016ca55d38dbb4861dafecb56364a4 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "apps/custom_launcher_page_contents.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
@@ -13,6 +14,7 @@
#include "base/stl_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/search/hotword_service.h"
@@ -162,13 +164,14 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile,
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());
+ custom_page_contents_.reset(new apps::CustomLauncherPageContents());
+ custom_page_contents_->Initialize(profile, custom_launcher_page_url);
+ // This observer will activate the extension when it is navigated to,
+ // which allows Dispatcher to give it the proper context and makes it
+ // behave like an extension.
+ extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
not at google - send to devlin 2014/07/09 15:14:39 seems like it would be better for CustomLauncherPa
Matt Giuca 2014/07/10 03:45:17 Yeah I agree. I didn't do it for consistency with
+ custom_page_contents_->GetWebContents());
+ custom_page_contents_->LoadContents();
}
}
}
@@ -481,13 +484,14 @@ views::View* AppListViewDelegate::CreateStartPageWebView(
views::View* AppListViewDelegate::CreateCustomPageWebView(
const gfx::Size& size) {
- if (!custom_page_web_contents_)
+ if (!custom_page_contents_)
return NULL;
- views::WebView* web_view = new views::WebView(
- custom_page_web_contents_->GetBrowserContext());
+ content::WebContents* web_contents = custom_page_contents_->GetWebContents();
+ views::WebView* web_view =
+ new views::WebView(web_contents->GetBrowserContext());
web_view->SetPreferredSize(size);
- web_view->SetWebContents(custom_page_web_contents_.get());
+ web_view->SetWebContents(web_contents);
return web_view;
}
#endif
« apps/custom_launcher_page_contents.h ('K') | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698