| 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/extensions/window_controller.h" | 10 #include "chrome/browser/extensions/window_controller.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (options->left.get() || options->top.get()) { | 76 if (options->left.get() || options->top.get()) { |
| 77 if (options->left.get()) | 77 if (options->left.get()) |
| 78 create_params.bounds.set_x(*options->left.get()); | 78 create_params.bounds.set_x(*options->left.get()); |
| 79 if (options->top.get()) | 79 if (options->top.get()) |
| 80 create_params.bounds.set_y(*options->top.get()); | 80 create_params.bounds.set_y(*options->top.get()); |
| 81 create_params.restore_position = false; | 81 create_params.restore_position = false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (options->frame.get()) { | 84 if (options->frame.get()) { |
| 85 if (*options->frame == kHtmlFrameOption && | 85 if (*options->frame == kHtmlFrameOption && |
| 86 CommandLine::ForCurrentProcess()->HasSwitch( | 86 GetExtension()->HasAPIPermission(APIPermission::kExperimental)) { |
| 87 switches::kEnableExperimentalExtensionApis)) { | |
| 88 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 87 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; |
| 89 inject_html_titlebar = true; | 88 inject_html_titlebar = true; |
| 90 } else if (*options->frame == kNoneFrameOption) { | 89 } else if (*options->frame == kNoneFrameOption) { |
| 91 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 90 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; |
| 92 } else { | 91 } else { |
| 93 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME; | 92 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME; |
| 94 } | 93 } |
| 95 } | 94 } |
| 96 | 95 |
| 96 if (options->transparent_background.get() && |
| 97 GetExtension()->HasAPIPermission(APIPermission::kExperimental)) { |
| 98 create_params.transparent_background = *options->transparent_background; |
| 99 } |
| 100 |
| 97 gfx::Size& minimum_size = create_params.minimum_size; | 101 gfx::Size& minimum_size = create_params.minimum_size; |
| 98 if (options->min_width.get()) | 102 if (options->min_width.get()) |
| 99 minimum_size.set_width(*options->min_width); | 103 minimum_size.set_width(*options->min_width); |
| 100 if (options->min_height.get()) | 104 if (options->min_height.get()) |
| 101 minimum_size.set_height(*options->min_height); | 105 minimum_size.set_height(*options->min_height); |
| 102 gfx::Size& maximum_size = create_params.maximum_size; | 106 gfx::Size& maximum_size = create_params.maximum_size; |
| 103 if (options->max_width.get()) | 107 if (options->max_width.get()) |
| 104 maximum_size.set_width(*options->max_width); | 108 maximum_size.set_width(*options->max_width); |
| 105 if (options->max_height.get()) | 109 if (options->max_height.get()) |
| 106 maximum_size.set_height(*options->max_height); | 110 maximum_size.set_height(*options->max_height); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 133 base::DictionaryValue* result = new base::DictionaryValue; | 137 base::DictionaryValue* result = new base::DictionaryValue; |
| 134 result->Set("viewId", base::Value::CreateIntegerValue(view_id)); | 138 result->Set("viewId", base::Value::CreateIntegerValue(view_id)); |
| 135 result->Set("injectTitlebar", | 139 result->Set("injectTitlebar", |
| 136 base::Value::CreateBooleanValue(inject_html_titlebar)); | 140 base::Value::CreateBooleanValue(inject_html_titlebar)); |
| 137 result->Set("id", base::Value::CreateStringValue(shell_window->window_key())); | 141 result->Set("id", base::Value::CreateStringValue(shell_window->window_key())); |
| 138 SetResult(result); | 142 SetResult(result); |
| 139 return true; | 143 return true; |
| 140 } | 144 } |
| 141 | 145 |
| 142 } // namespace extensions | 146 } // namespace extensions |
| OLD | NEW |