Skip to content

Commit

Permalink
Revert 215753 "Move native_app_window code to apps areas"
Browse files Browse the repository at this point in the history
> Move native_app_window code to apps areas
> 
> native_app_window.h -> apps component
> platform specific implementations of this are now in c/b/ui/xxx/apps.
> 
> The platform specific implementations should also move to apps/ but
> they would currently bring some unwanted dependencies with them; that
> can happen later.
> 
> BUG=159366
> 
> Review URL: https://chromiumcodereview.appspot.com/21344002

TBR=benwells@chromium.org

Review URL: https://codereview.chromium.org/22355002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215781 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
benwells@chromium.org committed Aug 6, 2013
1 parent d3c4b75 commit bfe665c
Show file tree
Hide file tree
Showing 39 changed files with 106 additions and 137 deletions.
1 change: 1 addition & 0 deletions apps/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include_rules = [
"+chrome/browser/lifetime/application_lifetime.h",
"+chrome/browser/profiles",
"+chrome/browser/sessions/session_id.h",
"+chrome/browser/ui/extensions/native_app_window.h",
"+chrome/browser/ui/host_desktop.h",
"+chrome/common/chrome_switches.h",
"+chrome/common/extensions",
Expand Down
2 changes: 1 addition & 1 deletion apps/app_shim/extension_app_shim_handler_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "apps/app_shim/app_shim_host_manager_mac.h"
#include "apps/app_shim/app_shim_messages.h"
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "base/files/file_path.h"
#include "base/logging.h"
Expand All @@ -21,6 +20,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/web_applications/web_app_mac.h"
#include "content/public/browser/notification_details.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/app_window_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "apps/app_window_contents.h"

#include "apps/native_app_window.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/browser_thread.h"
Expand Down
1 change: 0 additions & 1 deletion apps/apps.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
'field_trial_names.cc',
'field_trial_names.h',
'metrics_names.h',
'native_app_window.h',
'pref_names.cc',
'pref_names.h',
'prefs.cc',
Expand Down
4 changes: 2 additions & 2 deletions apps/shell_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "apps/shell_window.h"

#include "apps/native_app_window.h"
#include "apps/shell_window_geometry_cache.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
Expand All @@ -16,6 +15,7 @@
#include "chrome/browser/extensions/suggest_permission_util.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_messages.h"
Expand Down Expand Up @@ -156,7 +156,7 @@ void ShellWindow::Init(const GURL& url,

new_params.bounds = bounds;

native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params));
native_app_window_.reset(NativeAppWindow::Create(this, new_params));

if (!new_params.hidden) {
if (window_type_is_panel())
Expand Down
6 changes: 1 addition & 5 deletions apps/shell_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

class GURL;
class Profile;
class NativeAppWindow;
class SkRegion;

namespace content {
Expand All @@ -41,8 +42,6 @@ class BaseWindow;

namespace apps {

class NativeAppWindow;

// Manages the web contents for Shell Windows. The implementation for this
// class should create and maintain the WebContents for the window, and handle
// any message passing between the web contents and the extension system or
Expand Down Expand Up @@ -131,9 +130,6 @@ class ShellWindow : public content::NotificationObserver,

// General initialization.
virtual void InitWebContents(content::WebContents* web_contents) = 0;
virtual NativeAppWindow* CreateNativeAppWindow(
ShellWindow* window,
const CreateParams& params) = 0;

// Link handling.
virtual content::WebContents* OpenURLFromTab(
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/extensions/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include_rules = [
# to depend on apps will be lifted.
"-apps",
"+apps/app_window_contents.h",
"+apps/native_app_window.h",
"+apps/shell_window.h",

# TODO(tfarina): Remove all these. crbug.com/125846.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include "chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h"

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "base/command_line.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/api/app_current_window_internal.h"
#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/features/feature.h"
Expand Down
9 changes: 5 additions & 4 deletions chrome/browser/extensions/api/app_window/app_window_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "chrome/browser/extensions/api/app_window/app_window_api.h"

#include "apps/app_window_contents.h"
#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "base/command_line.h"
#include "base/time/time.h"
Expand All @@ -16,6 +15,7 @@
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/extensions/window_controller.h"
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/features/feature.h"
#include "content/public/browser/notification_registrar.h"
Expand Down Expand Up @@ -294,9 +294,10 @@ bool AppWindowCreateFunction::RunImpl() {
if (force_maximize)
create_params.state = ui::SHOW_STATE_MAXIMIZED;

ShellWindow* shell_window = new ShellWindow(profile(),
new ChromeShellWindowDelegate(),
GetExtension());
ShellWindow* shell_window = new ShellWindow(
profile(),
new chrome::ChromeShellWindowDelegate(),
GetExtension());
shell_window->Init(url,
new apps::AppWindowContents(shell_window),
create_params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/platform_app_browsertest_util.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/test/base/testing_profile.h"
#include "ui/base/base_window.h"
#include "ui/gfx/rect.h"
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/extensions/api/tabs/ash_panel_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "chrome/browser/extensions/api/tabs/ash_panel_contents.h"

#include "apps/native_app_window.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
Expand All @@ -14,14 +13,14 @@
#include "chrome/browser/extensions/window_controller_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/image/image.h"

using apps::ShellWindow;
using apps::NativeAppWindow;

// AshPanelWindowController ----------------------------------------------------

Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/extensions/api/tabs/ash_panel_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class AshPanelContents : public apps::ShellWindowContents,
// apps::ShellWindowContents
virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE;
virtual void NativeWindowChanged(apps::NativeAppWindow* native_app_window)
OVERRIDE;
virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE;
virtual void NativeWindowClosed() OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE;

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/api/tabs/tabs_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ bool WindowsCreateFunction::RunImpl() {
create_params.bounds = window_bounds;
create_params.focused = saw_focus_key && focused;
ShellWindow* shell_window = new ShellWindow(
window_profile, new ChromeShellWindowDelegate(),
window_profile, new chrome::ChromeShellWindowDelegate(),
GetExtension());
AshPanelContents* ash_panel_contents = new AshPanelContents(shell_window);
shell_window->Init(urls[0], ash_panel_contents, create_params);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/platform_app_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "base/bind.h"
#include "base/command_line.h"
Expand Down Expand Up @@ -32,6 +31,7 @@
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
Expand Down
11 changes: 6 additions & 5 deletions chrome/browser/extensions/platform_app_browsertest_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "chrome/browser/extensions/platform_app_browsertest_util.h"

#include "apps/app_window_contents.h"
#include "apps/native_app_window.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/tabs/tabs_api.h"
Expand All @@ -14,6 +13,7 @@
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
Expand All @@ -27,7 +27,7 @@ namespace utils = extension_function_test_utils;
namespace extensions {

PlatformAppBrowserTest::PlatformAppBrowserTest() {
ChromeShellWindowDelegate::DisableExternalOpenForTesting();
chrome::ChromeShellWindowDelegate::DisableExternalOpenForTesting();
}

void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) {
Expand Down Expand Up @@ -153,9 +153,10 @@ ShellWindow* PlatformAppBrowserTest::CreateShellWindow(

ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams(
const Extension* extension, const ShellWindow::CreateParams& params) {
ShellWindow* window = new ShellWindow(browser()->profile(),
new ChromeShellWindowDelegate(),
extension);
ShellWindow* window = new ShellWindow(
browser()->profile(),
new chrome::ChromeShellWindowDelegate(),
extension);
window->Init(GURL(std::string()),
new apps::AppWindowContents(window),
params);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/extensions/shell_window_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/common/extensions/extension.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "content/public/browser/devtools_agent_host.h"
Expand Down
10 changes: 4 additions & 6 deletions chrome/browser/ui/apps/chrome_shell_window_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "ash/launcher/launcher_types.h"
#endif

namespace chrome {

namespace {

bool disable_external_open_for_testing_ = false;
Expand Down Expand Up @@ -63,12 +65,6 @@ void ChromeShellWindowDelegate::InitWebContents(
#endif
}

apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindow(
apps::ShellWindow* window,
const apps::ShellWindow::CreateParams& params) {
return CreateNativeAppWindowImpl(window, params);
}

content::WebContents* ChromeShellWindowDelegate::OpenURLFromTab(
Profile* profile,
content::WebContents* source,
Expand Down Expand Up @@ -152,3 +148,5 @@ bool ChromeShellWindowDelegate::IsWebContentsVisible(
content::WebContents* web_contents) {
return platform_util::IsVisible(web_contents->GetView()->GetNativeView());
}

} // namespace chrome
12 changes: 4 additions & 8 deletions chrome/browser/ui/apps/chrome_shell_window_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/rect.h"

namespace chrome {

class ShellWindowLinkDelegate : public content::WebContentsDelegate {
public:
ShellWindowLinkDelegate();
Expand All @@ -36,9 +38,6 @@ class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
private:
// apps::ShellWindow::Delegate:
virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE;
virtual apps::NativeAppWindow* CreateNativeAppWindow(
apps::ShellWindow* window,
const apps::ShellWindow::CreateParams& params) OVERRIDE;
virtual content::WebContents* OpenURLFromTab(
Profile* profile,
content::WebContents* source,
Expand Down Expand Up @@ -66,14 +65,11 @@ class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
virtual bool IsWebContentsVisible(
content::WebContents* web_contents) OVERRIDE;

// Implemented in platform specific code.
static apps::NativeAppWindow* CreateNativeAppWindowImpl(
apps::ShellWindow* window,
const apps::ShellWindow::CreateParams& params);

scoped_ptr<ShellWindowLinkDelegate> shell_window_link_delegate_;

DISALLOW_COPY_AND_ASSIGN(ChromeShellWindowDelegate);
};

} // namespace chrome

#endif // CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_
2 changes: 1 addition & 1 deletion chrome/browser/ui/ash/chrome_shell_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "chrome/browser/ui/ash/chrome_shell_delegate.h"

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "ash/ash_switches.h"
#include "ash/host/root_window_host_factory.h"
Expand Down Expand Up @@ -38,6 +37,7 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/immersive_fullscreen_configuration.h"
#include "chrome/common/chrome_switches.h"
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "chrome/browser/ui/ash/chrome_shell_delegate.h"

#include "apps/native_app_window.h"
#include "apps/shell_window.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
Expand All @@ -17,6 +16,7 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/immersive_fullscreen_configuration.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "ui/aura/client/aura_constants.h"
Expand Down Expand Up @@ -175,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(ChromeShellDelegatePlatformAppBrowserTest,

const extensions::Extension* extension = LoadAndLaunchPlatformApp("minimal");
apps::ShellWindow* shell_window = CreateShellWindow(extension);
apps::NativeAppWindow* app_window = shell_window->GetBaseWindow();
NativeAppWindow* app_window = shell_window->GetBaseWindow();
ASSERT_TRUE(shell_window->GetBaseWindow()->IsActive());
EXPECT_FALSE(app_window->IsMaximized());
EXPECT_FALSE(app_window->IsFullscreen());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "chrome/browser/ui/ash/chrome_shell_delegate.h"

#include "apps/native_app_window.h"
#include "ash/keyboard_overlay/keyboard_overlay_view.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
Expand All @@ -30,6 +29,7 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
Expand Down
Loading

0 comments on commit bfe665c

Please sign in to comment.