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

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: . 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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 if (bounds->width.get()) 144 if (bounds->width.get())
144 create_params.bounds.set_width(*bounds->width.get()); 145 create_params.bounds.set_width(*bounds->width.get());
145 if (bounds->height.get()) 146 if (bounds->height.get())
146 create_params.bounds.set_height(*bounds->height.get()); 147 create_params.bounds.set_height(*bounds->height.get());
147 if (bounds->left.get()) 148 if (bounds->left.get())
148 create_params.bounds.set_x(*bounds->left.get()); 149 create_params.bounds.set_x(*bounds->left.get());
149 if (bounds->top.get()) 150 if (bounds->top.get())
150 create_params.bounds.set_y(*bounds->top.get()); 151 create_params.bounds.set_y(*bounds->top.get());
151 } 152 }
152 153
154 if (options->type.get()) {
155 if (*options->type == kPanelTypeOption)
156 create_params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
157 }
158
153 if (options->frame.get()) { 159 if (options->frame.get()) {
154 if (*options->frame == kHtmlFrameOption && 160 if (*options->frame == kHtmlFrameOption &&
155 CommandLine::ForCurrentProcess()->HasSwitch( 161 CommandLine::ForCurrentProcess()->HasSwitch(
156 switches::kEnableExperimentalExtensionApis)) { 162 switches::kEnableExperimentalExtensionApis)) {
157 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; 163 create_params.frame = ShellWindow::CreateParams::FRAME_NONE;
158 inject_html_titlebar = true; 164 inject_html_titlebar = true;
159 } else if (*options->frame == kNoneFrameOption) { 165 } else if (*options->frame == kNoneFrameOption) {
160 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; 166 create_params.frame = ShellWindow::CreateParams::FRAME_NONE;
161 } else { 167 } else {
162 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME; 168 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { 226 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) {
221 new DevToolsRestorer(this, created_view); 227 new DevToolsRestorer(this, created_view);
222 return true; 228 return true;
223 } 229 }
224 230
225 SendResponse(true); 231 SendResponse(true);
226 return true; 232 return true;
227 } 233 }
228 234
229 } // namespace extensions 235 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698