OLD | NEW |
---|---|
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 Loading... | |
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 | |
125 if (options->width.get() || options->height.get()) { | 126 if (options->width.get() || options->height.get()) { |
Marijn Kruisselbrink
2012/11/12 17:56:51
nit: With the restore_size bit gone, there is no r
| |
126 if (options->width.get()) | 127 if (options->width.get()) |
127 create_params.bounds.set_width(*options->width.get()); | 128 create_params.bounds.set_width(*options->width.get()); |
128 if (options->height.get()) | 129 if (options->height.get()) |
129 create_params.bounds.set_height(*options->height.get()); | 130 create_params.bounds.set_height(*options->height.get()); |
130 create_params.restore_size = false; | |
131 } | 131 } |
132 | 132 |
133 if (options->left.get() || options->top.get()) { | 133 if (options->left.get() || options->top.get()) { |
Marijn Kruisselbrink
2012/11/12 17:56:51
same here, this outer if no longer has a purpose
| |
134 if (options->left.get()) | 134 if (options->left.get()) |
135 create_params.bounds.set_x(*options->left.get()); | 135 create_params.bounds.set_x(*options->left.get()); |
136 if (options->top.get()) | 136 if (options->top.get()) |
137 create_params.bounds.set_y(*options->top.get()); | 137 create_params.bounds.set_y(*options->top.get()); |
138 create_params.restore_position = false; | |
139 } | 138 } |
140 | 139 |
141 if (options->frame.get()) { | 140 if (options->frame.get()) { |
142 if (*options->frame == kHtmlFrameOption && | 141 if (*options->frame == kHtmlFrameOption && |
143 CommandLine::ForCurrentProcess()->HasSwitch( | 142 CommandLine::ForCurrentProcess()->HasSwitch( |
144 switches::kEnableExperimentalExtensionApis)) { | 143 switches::kEnableExperimentalExtensionApis)) { |
145 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 144 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; |
146 inject_html_titlebar = true; | 145 inject_html_titlebar = true; |
147 } else if (*options->frame == kNoneFrameOption) { | 146 } else if (*options->frame == kNoneFrameOption) { |
148 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 147 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { | 207 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { |
209 new DevToolsRestorer(this, created_view); | 208 new DevToolsRestorer(this, created_view); |
210 return true; | 209 return true; |
211 } | 210 } |
212 | 211 |
213 SendResponse(true); | 212 SendResponse(true); |
214 return true; | 213 return true; |
215 } | 214 } |
216 | 215 |
217 } // namespace extensions | 216 } // namespace extensions |
OLD | NEW |