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

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

Issue 11362003: Make app windows restore position even if bounds are explicitly specified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-rebase Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/debugger/devtools_window.h" 10 #include "chrome/browser/debugger/devtools_window.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // TODO(mek): use URL if no id specified? 105 // TODO(mek): use URL if no id specified?
106 // Limit length of id to 256 characters. 106 // Limit length of id to 256 characters.
107 if (options->id->length() > 256) { 107 if (options->id->length() > 256) {
108 error_ = app_window_constants::kInvalidWindowId; 108 error_ = app_window_constants::kInvalidWindowId;
109 return false; 109 return false;
110 } 110 }
111 111
112 create_params.window_key = *options->id; 112 create_params.window_key = *options->id;
113 } 113 }
114 114
115 // TODO(jeremya): remove these, since they do the same thing as
116 // left/top/width/height.
115 if (options->default_width.get()) 117 if (options->default_width.get())
116 create_params.bounds.set_width(*options->default_width.get()); 118 create_params.bounds.set_width(*options->default_width.get());
117 if (options->default_height.get()) 119 if (options->default_height.get())
118 create_params.bounds.set_height(*options->default_height.get()); 120 create_params.bounds.set_height(*options->default_height.get());
119 if (options->default_left.get()) 121 if (options->default_left.get())
120 create_params.bounds.set_x(*options->default_left.get()); 122 create_params.bounds.set_x(*options->default_left.get());
121 if (options->default_top.get()) 123 if (options->default_top.get())
122 create_params.bounds.set_y(*options->default_top.get()); 124 create_params.bounds.set_y(*options->default_top.get());
123 125
124 126 if (options->width.get())
125 if (options->width.get() || options->height.get()) { 127 create_params.bounds.set_width(*options->width.get());
126 if (options->width.get()) 128 if (options->height.get())
127 create_params.bounds.set_width(*options->width.get()); 129 create_params.bounds.set_height(*options->height.get());
128 if (options->height.get()) 130 if (options->left.get())
129 create_params.bounds.set_height(*options->height.get()); 131 create_params.bounds.set_x(*options->left.get());
130 create_params.restore_size = false; 132 if (options->top.get())
131 } 133 create_params.bounds.set_y(*options->top.get());
132
133 if (options->left.get() || options->top.get()) {
134 if (options->left.get())
135 create_params.bounds.set_x(*options->left.get());
136 if (options->top.get())
137 create_params.bounds.set_y(*options->top.get());
138 create_params.restore_position = false;
139 }
140 134
141 if (options->bounds.get()) { 135 if (options->bounds.get()) {
142 app_window::Bounds* bounds = options->bounds.get(); 136 app_window::Bounds* bounds = options->bounds.get();
143 if (bounds->width.get()) 137 if (bounds->width.get())
144 create_params.bounds.set_width(*bounds->width.get()); 138 create_params.bounds.set_width(*bounds->width.get());
145 if (bounds->height.get()) 139 if (bounds->height.get())
146 create_params.bounds.set_height(*bounds->height.get()); 140 create_params.bounds.set_height(*bounds->height.get());
147 if (bounds->left.get()) 141 if (bounds->left.get())
148 create_params.bounds.set_x(*bounds->left.get()); 142 create_params.bounds.set_x(*bounds->left.get());
149 if (bounds->top.get()) 143 if (bounds->top.get())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { 214 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) {
221 new DevToolsRestorer(this, created_view); 215 new DevToolsRestorer(this, created_view);
222 return true; 216 return true;
223 } 217 }
224 218
225 SendResponse(true); 219 SendResponse(true);
226 return true; 220 return true;
227 } 221 }
228 222
229 } // namespace extensions 223 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698