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

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

Issue 11363250: Allow Chrome apps to create Ash Panels (apps v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac and win builds Created 8 years 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/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 15 matching lines...) Expand all
26 namespace app_window = extensions::api::app_window; 26 namespace app_window = extensions::api::app_window;
27 namespace Create = app_window::Create; 27 namespace Create = app_window::Create;
28 28
29 namespace extensions { 29 namespace extensions {
30 30
31 namespace app_window_constants { 31 namespace app_window_constants {
32 const char kInvalidWindowId[] = 32 const char kInvalidWindowId[] =
33 "The window id can not be more than 256 characters long."; 33 "The window id can not be more than 256 characters long.";
34 } 34 }
35 35
36 const char kPanelTypeOption[] = "panel";
36 const char kNoneFrameOption[] = "none"; 37 const char kNoneFrameOption[] = "none";
37 const char kHtmlFrameOption[] = "experimental-html"; 38 const char kHtmlFrameOption[] = "experimental-html";
38 39
39 namespace { 40 namespace {
40 41
41 // Opens an inspector window and delays the response to the 42 // Opens an inspector window and delays the response to the
42 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is 43 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is
43 // ready to stop on breakpoints in the callback. 44 // ready to stop on breakpoints in the callback.
44 class DevToolsRestorer : public content::NotificationObserver { 45 class DevToolsRestorer : public content::NotificationObserver {
45 public: 46 public:
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (bounds->width.get()) 138 if (bounds->width.get())
138 create_params.bounds.set_width(*bounds->width.get()); 139 create_params.bounds.set_width(*bounds->width.get());
139 if (bounds->height.get()) 140 if (bounds->height.get())
140 create_params.bounds.set_height(*bounds->height.get()); 141 create_params.bounds.set_height(*bounds->height.get());
141 if (bounds->left.get()) 142 if (bounds->left.get())
142 create_params.bounds.set_x(*bounds->left.get()); 143 create_params.bounds.set_x(*bounds->left.get());
143 if (bounds->top.get()) 144 if (bounds->top.get())
144 create_params.bounds.set_y(*bounds->top.get()); 145 create_params.bounds.set_y(*bounds->top.get());
145 } 146 }
146 147
148 if (CommandLine::ForCurrentProcess()->HasSwitch(
149 switches::kEnableExperimentalExtensionApis)) {
150 if (options->type.get()) {
151 if (*options->type == kPanelTypeOption)
152 create_params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
153 }
154 }
155
147 if (options->frame.get()) { 156 if (options->frame.get()) {
148 if (*options->frame == kHtmlFrameOption && 157 if (*options->frame == kHtmlFrameOption &&
149 CommandLine::ForCurrentProcess()->HasSwitch( 158 CommandLine::ForCurrentProcess()->HasSwitch(
150 switches::kEnableExperimentalExtensionApis)) { 159 switches::kEnableExperimentalExtensionApis)) {
151 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; 160 create_params.frame = ShellWindow::FRAME_NONE;
152 inject_html_titlebar = true; 161 inject_html_titlebar = true;
153 } else if (*options->frame == kNoneFrameOption) { 162 } else if (*options->frame == kNoneFrameOption) {
154 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; 163 create_params.frame = ShellWindow::FRAME_NONE;
155 } else { 164 } else {
156 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME; 165 create_params.frame = ShellWindow::FRAME_CHROME;
157 } 166 }
158 } 167 }
159 168
160 gfx::Size& minimum_size = create_params.minimum_size; 169 gfx::Size& minimum_size = create_params.minimum_size;
161 if (options->min_width.get()) 170 if (options->min_width.get())
162 minimum_size.set_width(*options->min_width); 171 minimum_size.set_width(*options->min_width);
163 if (options->min_height.get()) 172 if (options->min_height.get())
164 minimum_size.set_height(*options->min_height); 173 minimum_size.set_height(*options->min_height);
165 gfx::Size& maximum_size = create_params.maximum_size; 174 gfx::Size& maximum_size = create_params.maximum_size;
166 if (options->max_width.get()) 175 if (options->max_width.get())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { 210 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) {
202 new DevToolsRestorer(this, created_view); 211 new DevToolsRestorer(this, created_view);
203 return true; 212 return true;
204 } 213 }
205 214
206 SendResponse(true); 215 SendResponse(true);
207 return true; 216 return true;
208 } 217 }
209 218
210 } // namespace extensions 219 } // namespace extensions
OLDNEW
« no previous file with comments | « ash/wm/panel_layout_manager_unittest.cc ('k') | chrome/browser/ui/ash/launcher/shell_window_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698