Skip to content

Commit

Permalink
Move NativeAppWindow to extensions
Browse files Browse the repository at this point in the history
Move native_app_window.h from apps/ui to extensions/browser/app_window.
Change the namespace from apps to extensions.
Add dependency on components/web_modal to extensions/browser.

BUG=403726
TBR=sky@chromium.org for include fix under chrome/browser

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

Cr-Commit-Position: refs/heads/master@{#290786}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290786 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
hashimoto@chromium.org committed Aug 20, 2014
1 parent 6e3ef09 commit 2accabe
Show file tree
Hide file tree
Showing 54 changed files with 106 additions and 84 deletions.
2 changes: 1 addition & 1 deletion apps/app_shim/app_shim_interactive_uitest_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "apps/app_shim/app_shim_host_manager_mac.h"
#include "apps/app_shim/extension_app_shim_handler_mac.h"
#include "apps/switches.h"
#include "apps/ui/native_app_window.h"
#include "base/auto_reset.h"
#include "base/callback.h"
#include "base/files/file_path_watcher.h"
Expand All @@ -30,6 +29,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/mac/app_mode_common.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extension_registry.h"
#import "ui/events/test/cocoa_test_event_utils.h"

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 @@ -10,7 +10,6 @@
#include "apps/app_window.h"
#include "apps/app_window_registry.h"
#include "apps/launcher.h"
#include "apps/ui/native_app_window.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
Expand All @@ -25,6 +24,7 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
#include "ui/base/cocoa/focus_window_set.h"
Expand Down
3 changes: 2 additions & 1 deletion apps/app_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "apps/app_window_geometry_cache.h"
#include "apps/app_window_registry.h"
#include "apps/ui/apps_client.h"
#include "apps/ui/native_app_window.h"
#include "apps/ui/web_contents_sizer.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
Expand All @@ -33,6 +32,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/media_stream_request.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/app_window/size_constraints.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
Expand All @@ -58,6 +58,7 @@ using content::BrowserContext;
using content::ConsoleMessageLevel;
using content::WebContents;
using extensions::APIPermission;
using extensions::NativeAppWindow;
using web_modal::WebContentsModalDialogHost;
using web_modal::WebContentsModalDialogManager;

Expand Down
9 changes: 5 additions & 4 deletions apps/app_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class WebContents;

namespace extensions {
class Extension;
class NativeAppWindow;
class PlatformAppBrowserTest;
class WindowController;

Expand All @@ -50,7 +51,6 @@ namespace apps {

class AppDelegate;
class AppWebContentsHelper;
class NativeAppWindow;

// Manages the web contents for app windows. The implementation for this
// class should create and maintain the WebContents for the window, and handle
Expand All @@ -69,7 +69,8 @@ class AppWindowContents {
virtual void LoadContents(int32 creator_process_id) = 0;

// Called when the native window changes.
virtual void NativeWindowChanged(NativeAppWindow* native_app_window) = 0;
virtual void NativeWindowChanged(
extensions::NativeAppWindow* native_app_window) = 0;

// Called when the native window closes.
virtual void NativeWindowClosed() = 0;
Expand Down Expand Up @@ -232,7 +233,7 @@ class AppWindow : public content::NotificationObserver,
bool is_hidden() const { return is_hidden_; }

const extensions::Extension* GetExtension() const;
NativeAppWindow* GetBaseWindow();
extensions::NativeAppWindow* GetBaseWindow();
gfx::NativeWindow GetNativeWindow();

// Returns the bounds that should be reported to the renderer.
Expand Down Expand Up @@ -500,7 +501,7 @@ class AppWindow : public content::NotificationObserver,
// An object to load the badge as an extension resource.
scoped_ptr<extensions::IconImage> badge_icon_image_;

scoped_ptr<NativeAppWindow> native_app_window_;
scoped_ptr<extensions::NativeAppWindow> native_app_window_;
scoped_ptr<AppWindowContents> app_window_contents_;
scoped_ptr<AppDelegate> app_delegate_;
scoped_ptr<AppWebContentsHelper> helper_;
Expand Down
3 changes: 2 additions & 1 deletion apps/app_window_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/ui/native_app_window.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "extensions/browser/app_window/native_app_window.h"

using extensions::Extension;
using extensions::NativeAppWindow;

namespace apps {

Expand Down
6 changes: 3 additions & 3 deletions apps/app_window_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

#include "apps/app_window_contents.h"

#include <utility>
#include <string>
#include <utility>

#include "apps/ui/native_app_window.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/extensions/api/app_window.h"
#include "content/public/browser/browser_context.h"
Expand All @@ -18,6 +17,7 @@
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/renderer_preferences.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/extension_messages.h"

namespace app_window = extensions::api::app_window;
Expand Down Expand Up @@ -65,7 +65,7 @@ void AppWindowContentsImpl::LoadContents(int32 creator_process_id) {
}

void AppWindowContentsImpl::NativeWindowChanged(
NativeAppWindow* native_app_window) {
extensions::NativeAppWindow* native_app_window) {
base::ListValue args;
base::DictionaryValue* dictionary = new base::DictionaryValue();
args.Append(dictionary);
Expand Down
3 changes: 2 additions & 1 deletion apps/app_window_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class AppWindowContentsImpl
virtual void Initialize(content::BrowserContext* context,
const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE;
virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE;
virtual void NativeWindowChanged(
extensions::NativeAppWindow* native_app_window) OVERRIDE;
virtual void NativeWindowClosed() OVERRIDE;
virtual void DispatchWindowShownForTests() const OVERRIDE;
virtual content::WebContents* GetWebContents() const OVERRIDE;
Expand Down
2 changes: 1 addition & 1 deletion apps/app_window_interactive_uitest.cc
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.

#include "apps/ui/native_app_window.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "extensions/browser/app_window/native_app_window.h"

using extensions::PlatformAppBrowserTest;
using extensions::Extension;
Expand Down
2 changes: 1 addition & 1 deletion apps/app_window_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

#include "apps/app_window.h"
#include "apps/ui/apps_client.h"
#include "apps/ui/native_app_window.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/extension.h"

Expand Down
1 change: 0 additions & 1 deletion apps/apps.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
'switches.h',
'ui/apps_client.cc',
'ui/apps_client.h',
'ui/native_app_window.h',
'ui/views/app_window_frame_view.cc',
'ui/views/app_window_frame_view.h',
'ui/views/native_app_window_views.cc',
Expand Down
7 changes: 3 additions & 4 deletions apps/ui/apps_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ class BrowserContext;

namespace extensions {
class Extension;
class NativeAppWindow;
}

namespace apps {

class NativeAppWindow;

// Sets up global state for the apps system. Should be Set() once in each
// process. This should be implemented by the client of the apps system.
class AppsClient {
Expand All @@ -34,8 +33,8 @@ class AppsClient {
content::BrowserContext* context,
const extensions::Extension* extension) = 0;

// Creates a new apps::NativeAppWindow for |window|.
virtual NativeAppWindow* CreateNativeAppWindow(
// Creates a new extensions::NativeAppWindow for |window|.
virtual extensions::NativeAppWindow* CreateNativeAppWindow(
AppWindow* window,
const AppWindow::CreateParams& params) = 0;

Expand Down
4 changes: 2 additions & 2 deletions apps/ui/views/app_window_frame_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "apps/ui/views/app_window_frame_view.h"

#include "apps/ui/native_app_window.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/draggable_region.h"
#include "grit/theme_resources.h"
#include "grit/ui_strings.h" // Accessibility names
Expand Down Expand Up @@ -38,7 +38,7 @@ const char AppWindowFrameView::kViewClassName[] =
"browser/ui/views/extensions/AppWindowFrameView";

AppWindowFrameView::AppWindowFrameView(views::Widget* widget,
NativeAppWindow* window,
extensions::NativeAppWindow* window,
bool draw_frame,
const SkColor& active_frame_color,
const SkColor& inactive_frame_color)
Expand Down
10 changes: 6 additions & 4 deletions apps/ui/views/app_window_frame_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

class SkRegion;

namespace extensions {
class NativeAppWindow;
}

namespace gfx {
class Canvas;
class Point;
Expand All @@ -32,8 +36,6 @@ class Widget;

namespace apps {

class NativeAppWindow;

// A frameless or non-Ash, non-panel NonClientFrameView for app windows.
class AppWindowFrameView : public views::NonClientFrameView,
public views::ButtonListener {
Expand All @@ -49,7 +51,7 @@ class AppWindowFrameView : public views::NonClientFrameView,
// TODO(benwells): Refactor this to split out frameless and colored frame
// views. See http://crbug.com/359432.
AppWindowFrameView(views::Widget* widget,
NativeAppWindow* window,
extensions::NativeAppWindow* window,
bool draw_frame,
const SkColor& active_frame_color,
const SkColor& inactive_frame_color);
Expand Down Expand Up @@ -96,7 +98,7 @@ class AppWindowFrameView : public views::NonClientFrameView,
SkColor CurrentFrameColor();

views::Widget* widget_;
NativeAppWindow* window_;
extensions::NativeAppWindow* window_;
bool draw_frame_;
SkColor active_frame_color_;
SkColor inactive_frame_color_;
Expand Down
5 changes: 3 additions & 2 deletions apps/ui/views/native_app_window_views.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#ifndef APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_
#define APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_

#include "apps/ui/native_app_window.h"
#include "apps/app_window.h"
#include "base/observer_list.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/app_window/size_constraints.h"
#include "ui/gfx/rect.h"
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
Expand Down Expand Up @@ -42,7 +43,7 @@ class AppWindowFrameView;

// A NativeAppWindow backed by a views::Widget. This class may be used alone
// as a stub or subclassed (for example, ChromeNativeAppWindowViews).
class NativeAppWindowViews : public NativeAppWindow,
class NativeAppWindowViews : public extensions::NativeAppWindow,
public content::WebContentsObserver,
public views::WidgetDelegateView,
public views::WidgetObserver {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/apps/app_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "apps/app_window.h"
#include "apps/app_window_registry.h"
#include "apps/launcher.h"
#include "apps/ui/native_app_window.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
Expand Down Expand Up @@ -38,6 +37,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/apps/app_browsertest_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "apps/app_window_contents.h"
#include "apps/app_window_registry.h"
#include "apps/ui/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 @@ -18,6 +17,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/switches.h"

using apps::AppWindow;
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/apps/app_window_interactive_uitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "apps/ui/native_app_window.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"

#if defined(OS_MACOSX) && !defined(OS_IOS)
#include "base/mac/mac_util.h"
Expand All @@ -20,7 +20,7 @@
#include "ui/views/win/hwnd_util.h"
#endif

using apps::NativeAppWindow;
using extensions::NativeAppWindow;

// Helper class that has to be created in the stack to check if the fullscreen
// setting of a NativeWindow has changed since the creation of the object.
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/apps/web_view_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/ui/native_app_window.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
Expand All @@ -29,6 +28,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fake_speech_recognition_manager.h"
#include "content/public/test/test_renderer_host.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/guest_view_manager_factory.h"
#include "extensions/common/extension.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/login/kiosk_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "apps/app_window.h"
#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/desktop_background_controller_observer.h"
#include "ash/shell.h"
Expand Down Expand Up @@ -47,6 +46,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extension_system.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_switches.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <string>
#include <vector>

#include "apps/app_window.h"
#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/shell.h"
#include "ash/system/chromeos/session/logout_confirmation_controller.h"
#include "ash/system/chromeos/session/logout_confirmation_dialog.h"
Expand Down Expand Up @@ -114,6 +114,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "crypto/rsa_private_key.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/notification_types.h"
Expand Down
Loading

0 comments on commit 2accabe

Please sign in to comment.