Skip to content

Commit

Permalink
Move CustomLauncherPageContents from apps to c/b/ui/app_list
Browse files Browse the repository at this point in the history
This is the most Chrome-dependent part of //apps, and is only used for the app
list in Chrome, so why not move it to chrome/browser/ui/app_list?

This enables us to make the rest of the //apps code independent of Chrome so it
can be used for app_shell.

Alternatively, we could make custom_launcher_page_contents.cc not depend on
Chrome (it's mostly for extensions::ChromeExtensionWebContentsObserver), but
that's probably better off being lumped into a larger task to move app_list out
of chrome if that should become a goal.

BUG=679971
R=benwells@chromium.org

Review-Url: https://codereview.chromium.org/2628883002
Cr-Commit-Position: refs/heads/master@{#443286}
  • Loading branch information
michaelpg authored and Commit bot committed Jan 12, 2017
1 parent e424e1f commit b2e0703
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
2 changes: 0 additions & 2 deletions apps/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ static_library("apps") {
"app_restore_service_factory.h",
"browser_context_keyed_service_factories.cc",
"browser_context_keyed_service_factories.h",
"custom_launcher_page_contents.cc",
"custom_launcher_page_contents.h",
"launcher.cc",
"launcher.h",
"metrics_names.h",
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3162,6 +3162,8 @@ split_static_library("ui") {
"app_list/app_list_view_delegate.h",
"app_list/chrome_app_list_item.cc",
"app_list/chrome_app_list_item.h",
"app_list/custom_launcher_page_contents.cc",
"app_list/custom_launcher_page_contents.h",
"app_list/extension_app_context_menu.cc",
"app_list/extension_app_context_menu.h",
"app_list/extension_app_item.cc",
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/app_list/app_list_view_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <vector>

#include "apps/custom_launcher_page_contents.h"
#include "base/callback.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
Expand All @@ -29,6 +28,7 @@
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/browser/ui/app_list/custom_launcher_page_contents.h"
#include "chrome/browser/ui/app_list/launcher_page_event_dispatcher.h"
#include "chrome/browser/ui/app_list/search/search_controller_factory.h"
#include "chrome/browser/ui/app_list/search/search_resource_manager.h"
Expand Down Expand Up @@ -316,7 +316,7 @@ void AppListViewDelegate::SetUpCustomLauncherPages() {
for (auto it = custom_launcher_page_urls.begin();
it != custom_launcher_page_urls.end(); ++it) {
std::string extension_id = it->host();
auto page_contents = base::MakeUnique<apps::CustomLauncherPageContents>(
auto page_contents = base::MakeUnique<app_list::CustomLauncherPageContents>(
base::MakeUnique<ChromeAppDelegate>(false), extension_id);
page_contents->Initialize(profile_, *it);
custom_page_contents_.push_back(std::move(page_contents));
Expand Down
7 changes: 2 additions & 5 deletions chrome/browser/ui/app_list/app_list_view_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
class AppListControllerDelegate;
class Profile;

namespace apps {
class CustomLauncherPageContents;
}

namespace app_list {
class CustomLauncherPageContents;
class LauncherPageEventDispatcher;
class SearchController;
class SearchResourceManager;
Expand Down Expand Up @@ -193,7 +190,7 @@ class AppListViewDelegate : public app_list::AppListViewDelegate,
ScopedObserver<SigninManagerBase, AppListViewDelegate> scoped_observer_;

// Window contents of additional custom launcher pages.
std::vector<std::unique_ptr<apps::CustomLauncherPageContents>>
std::vector<std::unique_ptr<app_list::CustomLauncherPageContents>>
custom_page_contents_;

// Registers for NOTIFICATION_APP_TERMINATING to unload custom launcher pages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/custom_launcher_page_contents.h"
#include "chrome/browser/ui/app_list/custom_launcher_page_contents.h"

#include <string>
#include <utility>
Expand All @@ -18,7 +18,7 @@
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/extension_messages.h"

namespace apps {
namespace app_list {

CustomLauncherPageContents::CustomLauncherPageContents(
std::unique_ptr<extensions::AppDelegate> app_delegate,
Expand Down Expand Up @@ -131,4 +131,4 @@ bool CustomLauncherPageContents::CheckMediaAccessPermission(
return helper_->CheckMediaAccessPermission(security_origin, type);
}

} // namespace apps
} // namespace app_list
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
#define APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
#ifndef CHROME_BROWSER_UI_APP_LIST_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
#define CHROME_BROWSER_UI_APP_LIST_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_

#include <memory>

Expand All @@ -20,7 +20,7 @@ class AppDelegate;
class AppWebContentsHelper;
}

namespace apps {
namespace app_list {

// Manages the web contents for extension-hosted launcher pages. The
// implementation for this class should create and maintain the WebContents for
Expand Down Expand Up @@ -79,6 +79,6 @@ class CustomLauncherPageContents : public content::WebContentsDelegate {
DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageContents);
};

} // namespace apps
} // namespace app_list

#endif // APPS_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_
#endif // CHROME_BROWSER_UI_APP_LIST_CUSTOM_LAUNCHER_PAGE_CONTENTS_H_

0 comments on commit b2e0703

Please sign in to comment.