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

Unified Diff: athena/extensions/athena_native_app_window_views.cc

Issue 668513003: Selecting an app window from the overview mode maximizes the window only if it's maximizable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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: athena/extensions/athena_native_app_window_views.cc
diff --git a/athena/extensions/athena_native_app_window_views.cc b/athena/extensions/athena_native_app_window_views.cc
index 866a9c4ce78fd12a79dc2eab5f091d80afba5bf3..5b18125ce483223add717a96a8a034bb6d7c75f1 100644
--- a/athena/extensions/athena_native_app_window_views.cc
+++ b/athena/extensions/athena_native_app_window_views.cc
@@ -10,4 +10,46 @@ views::WebView* AthenaNativeAppWindowViews::GetWebView() {
return web_view();
}
+// Specialized initialization of the AppWindowViews specific to Athena. Starts
+// the window maximized by default unless the create_params specifies a
+// maximum size, in which case the window will be centered.
+void AthenaNativeAppWindowViews::InitializeWindow(
oshima 2014/10/22 20:03:21 I think we need to handle this in different way. L
+ extensions::AppWindow* app_window,
+ const extensions::AppWindow::CreateParams& create_params) {
+
+ views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW);
+
+ // Use passed 'create_params' to initialize 'init_params'
+ init_params.delegate = this;
+ init_params.remove_standard_frame = IsFrameless();
+ init_params.use_system_default_icon = true;
+ init_params.keep_on_top = create_params.always_on_top;
+
+ init_params.visible_on_all_workspaces = create_params
+ .visible_on_all_workspaces;
+ if (create_params.alpha_enabled)
+ init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
+
+ // Only maximize the window if the content doesn't specify a maximum size,
+ // otherwise center the window in the screen with the given bounds.
+ bool need_to_center = false;
+ if (create_params.content_spec.maximum_size.IsEmpty()) {
+ init_params.show_state = ui::SHOW_STATE_MAXIMIZED;
+ } else {
+ init_params.show_state = create_params.state;
+ init_params.bounds = create_params.content_spec.bounds;
+ need_to_center = true;
+ }
+
+ // Initialize and create the widget
+ views::Widget* widget = this->widget();
+ widget->Init(init_params);
+
+ // The following should be inside views::Widget::Init(), I think!
+ if (need_to_center) {
+ widget->CenterWindow(
+ create_params.GetInitialWindowBounds(gfx::Insets()).size());
+ }
+}
+
} // namespace athena

Powered by Google App Engine
This is Rietveld 408576698