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

Side by Side Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 10871086: First part of remembering platform app window geometry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/app_window/app_window_api.h" 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/shell_window_registry.h" 9 #include "chrome/browser/extensions/shell_window_registry.h"
10 #include "chrome/browser/extensions/window_controller.h" 10 #include "chrome/browser/extensions/window_controller.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXTENSION_FUNCTION_VALIDATE(params.get()); 51 EXTENSION_FUNCTION_VALIDATE(params.get());
52 52
53 GURL url = GetExtension()->GetResourceURL(params->url); 53 GURL url = GetExtension()->GetResourceURL(params->url);
54 54
55 // TODO(jeremya): figure out a way to pass the opening WebContents through to 55 // TODO(jeremya): figure out a way to pass the opening WebContents through to
56 // ShellWindow::Create so we can set the opener at create time rather than 56 // ShellWindow::Create so we can set the opener at create time rather than
57 // with a hack in AppWindowCustomBindings::GetView(). 57 // with a hack in AppWindowCustomBindings::GetView().
58 ShellWindow::CreateParams create_params; 58 ShellWindow::CreateParams create_params;
59 app_window::CreateWindowOptions* options = params->options.get(); 59 app_window::CreateWindowOptions* options = params->options.get();
60 if (options) { 60 if (options) {
61 if (options->width.get()) 61 if (options->id.get())
62 create_params.bounds.set_width(*options->width.get()); 62 // TODO(mek): use URL if no id specified?
63 if (options->height.get()) 63 create_params.window_key = *options->id;
asargent_no_longer_on_chrome 2012/08/28 18:49:41 nit: can you enforce that the id is some reasonabl
Marijn Kruisselbrink 2012/08/28 22:14:58 Done.
64 create_params.bounds.set_height(*options->height.get()); 64
65 if (options->left.get()) 65 if (options->default_width.get())
66 create_params.bounds.set_x(*options->left.get()); 66 create_params.bounds.set_width(*options->default_width.get());
67 if (options->top.get()) 67 if (options->default_height.get())
68 create_params.bounds.set_y(*options->top.get()); 68 create_params.bounds.set_height(*options->default_height.get());
69 if (options->default_left.get())
70 create_params.bounds.set_x(*options->default_left.get());
71 if (options->default_top.get())
72 create_params.bounds.set_y(*options->default_top.get());
73
74
75 if (options->width.get() || options->height.get()) {
76 if (options->width.get())
77 create_params.bounds.set_width(*options->width.get());
78 if (options->height.get())
79 create_params.bounds.set_height(*options->height.get());
80 create_params.restoreSize = false;
81 }
82
83 if (options->left.get() || options->top.get()) {
84 if (options->left.get())
85 create_params.bounds.set_x(*options->left.get());
86 if (options->top.get())
87 create_params.bounds.set_y(*options->top.get());
88 create_params.restorePosition = false;
89 }
69 90
70 if (options->frame.get()) { 91 if (options->frame.get()) {
71 create_params.frame = *options->frame == kNoneFrameOption ? 92 create_params.frame = *options->frame == kNoneFrameOption ?
72 ShellWindow::CreateParams::FRAME_NONE : 93 ShellWindow::CreateParams::FRAME_NONE :
73 ShellWindow::CreateParams::FRAME_CHROME; 94 ShellWindow::CreateParams::FRAME_CHROME;
74 } 95 }
75 96
76 gfx::Size& minimum_size = create_params.minimum_size; 97 gfx::Size& minimum_size = create_params.minimum_size;
77 if (options->min_width.get()) 98 if (options->min_width.get())
78 minimum_size.set_width(*options->min_width); 99 minimum_size.set_width(*options->min_width);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 window->GetBaseWindow()->Minimize(); 148 window->GetBaseWindow()->Minimize();
128 return true; 149 return true;
129 } 150 }
130 151
131 bool AppWindowRestoreFunction::RunWithWindow(ShellWindow* window) { 152 bool AppWindowRestoreFunction::RunWithWindow(ShellWindow* window) {
132 window->GetBaseWindow()->Restore(); 153 window->GetBaseWindow()->Restore();
133 return true; 154 return true;
134 } 155 }
135 156
136 } // namespace extensions 157 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_system.h » ('j') | chrome/browser/extensions/shell_window_geometry_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698