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

Unified Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 213743017: Remove title and icon from chrome apps native style title bars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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/views/apps/chrome_native_app_window_views.cc
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
index 03279efb1001b56bb74767c7b3d09266cd17f7f1..76c1ca0b228ec5c2acb98eec278d221dd955fdf2 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views.cc
@@ -18,13 +18,13 @@
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
#include "extensions/common/extension.h"
+#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/widget/widget.h"
-#include "ui/wm/core/easy_resize_window_targeter.h"
#if defined(OS_LINUX)
#include "chrome/browser/shell_integration_linux.h"
@@ -45,14 +45,9 @@
#include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_tree_client.h"
-#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#endif
-#if defined(USE_AURA)
-#include "ui/aura/window.h"
-#endif
-
using apps::AppWindow;
namespace {
@@ -61,8 +56,6 @@ const int kMinPanelWidth = 100;
const int kMinPanelHeight = 100;
const int kDefaultPanelWidth = 200;
const int kDefaultPanelHeight = 300;
-const int kResizeInsideBoundsSize = 5;
-const int kResizeAreaCornerSize = 16;
struct AcceleratorMapping {
ui::KeyboardCode keycode;
@@ -331,41 +324,25 @@ void ChromeNativeAppWindowViews::InitializePanelWindow(
#endif
}
-void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const {
- aura::Window* root_window = widget()->GetNativeWindow()->GetRootWindow();
- gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
- kResizeInsideBoundsSize, kResizeInsideBoundsSize);
- root_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
- new wm::EasyResizeWindowTargeter(root_window, inset, inset)));
+views::NonClientFrameView*
+ChromeNativeAppWindowViews::CreateStandardAppWindowFrame() {
+ return views::WidgetDelegateView::CreateNonClientFrameView(widget());
}
apps::AppWindowFrameView*
-ChromeNativeAppWindowViews::CreateAppWindowFrameView() {
- // By default the user can resize the window from slightly inside the bounds.
- int resize_inside_bounds_size = kResizeInsideBoundsSize;
- int resize_outside_bounds_size = 0;
- int resize_outside_scale_for_touch = 1;
- int resize_area_corner_size = kResizeAreaCornerSize;
+ChromeNativeAppWindowViews::CreateNonStandardAppWindowFrame() {
+ apps::AppWindowFrameView* frame = new apps::AppWindowFrameView(
+ widget(), this, has_frame_color_, frame_color_);
#if defined(USE_ASH)
// For Aura windows on the Ash desktop the sizes are different and the user
// can resize the window from slightly outside the bounds as well.
if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) {
- resize_inside_bounds_size = ash::kResizeInsideBoundsSize;
- resize_outside_bounds_size = ash::kResizeOutsideBoundsSize;
- resize_outside_scale_for_touch = ash::kResizeOutsideBoundsScaleForTouch;
- resize_area_corner_size = ash::kResizeAreaCornerSize;
+ frame->SetResizeSizes(ash::kResizeInsideBoundsSize,
+ ash::kResizeOutsideBoundsSize,
+ ash::kResizeAreaCornerSize);
}
#endif
- apps::AppWindowFrameView* frame_view = new apps::AppWindowFrameView();
- frame_view->Init(widget(),
- this,
- has_frame_color_,
- frame_color_,
- resize_inside_bounds_size,
- resize_outside_bounds_size,
- resize_outside_scale_for_touch,
- resize_area_corner_size);
- return frame_view;
+ return frame;
}
// ui::BaseWindow implementation.
@@ -492,30 +469,33 @@ views::NonClientFrameView* ChromeNativeAppWindowViews::CreateNonClientFrameView(
return frame_view;
}
- if (!IsFrameless()) {
- ash::CustomFrameViewAsh* custom_frame_view =
- new ash::CustomFrameViewAsh(widget);
+ if (IsFrameless())
+ return CreateNonStandardAppWindowFrame();
+
+ ash::CustomFrameViewAsh* custom_frame_view =
+ new ash::CustomFrameViewAsh(widget);
#if defined(OS_CHROMEOS)
- // Non-frameless app windows can be put into immersive fullscreen.
- // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
- // Windows Ash.
- immersive_fullscreen_controller_.reset(
- new ash::ImmersiveFullscreenController());
- custom_frame_view->InitImmersiveFullscreenControllerForView(
- immersive_fullscreen_controller_.get());
+ // Non-frameless app windows can be put into immersive fullscreen.
+ // TODO(pkotwicz): Investigate if immersive fullscreen can be enabled for
+ // Windows Ash.
+ immersive_fullscreen_controller_.reset(
+ new ash::ImmersiveFullscreenController());
+ custom_frame_view->InitImmersiveFullscreenControllerForView(
+ immersive_fullscreen_controller_.get());
#endif
- custom_frame_view->GetHeaderView()->set_context_menu_controller(this);
- return custom_frame_view;
- }
+ custom_frame_view->GetHeaderView()->set_context_menu_controller(this);
+ return custom_frame_view;
}
#endif
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- return CreateAppWindowFrameView();
+ // Linux always uses the non standard frame view because the OS draws the
+ // frame (if a frame is needed).
+ return CreateNonStandardAppWindowFrame();
#else
if (IsFrameless() || has_frame_color_)
- return CreateAppWindowFrameView();
+ return CreateNonStandardAppWindowFrame();
#endif
- return views::WidgetDelegateView::CreateNonClientFrameView(widget);
+ return CreateStandardAppWindowFrame();
}
bool ChromeNativeAppWindowViews::WidgetHasHitTestMask() const {
@@ -670,12 +650,4 @@ void ChromeNativeAppWindowViews::InitializeWindow(
widget()->GetFocusManager(),
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
NULL));
-
-#if defined(OS_WIN)
- if ((IsFrameless() || has_frame_color_) &&
- chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) !=
- chrome::HOST_DESKTOP_TYPE_ASH) {
- InstallEasyResizeTargeterOnContainer();
- }
-#endif
}

Powered by Google App Engine
This is Rietveld 408576698