| 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 "extensions/browser/api/app_window/app_window_api.h" | 5 #include "extensions/browser/api/app_window/app_window_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 if (!options->hidden.get() || !*options->hidden) { | 189 if (!options->hidden.get() || !*options->hidden) { |
| 190 if (options->focused.get() && !*options->focused) | 190 if (options->focused.get() && !*options->focused) |
| 191 existing_window->Show(AppWindow::SHOW_INACTIVE); | 191 existing_window->Show(AppWindow::SHOW_INACTIVE); |
| 192 else | 192 else |
| 193 existing_window->Show(AppWindow::SHOW_ACTIVE); | 193 existing_window->Show(AppWindow::SHOW_ACTIVE); |
| 194 } | 194 } |
| 195 | 195 |
| 196 std::unique_ptr<base::DictionaryValue> result( | 196 std::unique_ptr<base::DictionaryValue> result( |
| 197 new base::DictionaryValue); | 197 new base::DictionaryValue); |
| 198 result->Set("frameId", new base::Value(frame_id)); | 198 result->SetInteger("frameId", frame_id); |
| 199 existing_window->GetSerializedState(result.get()); | 199 existing_window->GetSerializedState(result.get()); |
| 200 result->SetBoolean("existingWindow", true); | 200 result->SetBoolean("existingWindow", true); |
| 201 return RespondNow(OneArgument(std::move(result))); | 201 return RespondNow(OneArgument(std::move(result))); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 std::string error; | 206 std::string error; |
| 207 if (!GetBoundsSpec(*options, &create_params, &error)) | 207 if (!GetBoundsSpec(*options, &create_params, &error)) |
| 208 return RespondNow(Error(error)); | 208 return RespondNow(Error(error)); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 app_window->ForcedFullscreen(); | 369 app_window->ForcedFullscreen(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 content::RenderFrameHost* created_frame = | 372 content::RenderFrameHost* created_frame = |
| 373 app_window->web_contents()->GetMainFrame(); | 373 app_window->web_contents()->GetMainFrame(); |
| 374 int frame_id = MSG_ROUTING_NONE; | 374 int frame_id = MSG_ROUTING_NONE; |
| 375 if (create_params.creator_process_id == created_frame->GetProcess()->GetID()) | 375 if (create_params.creator_process_id == created_frame->GetProcess()->GetID()) |
| 376 frame_id = created_frame->GetRoutingID(); | 376 frame_id = created_frame->GetRoutingID(); |
| 377 | 377 |
| 378 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); | 378 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
| 379 result->Set("frameId", new base::Value(frame_id)); | 379 result->SetInteger("frameId", frame_id); |
| 380 result->Set("id", new base::Value(app_window->window_key())); | 380 result->SetString("id", app_window->window_key()); |
| 381 app_window->GetSerializedState(result.get()); | 381 app_window->GetSerializedState(result.get()); |
| 382 ResponseValue result_arg = OneArgument(std::move(result)); | 382 ResponseValue result_arg = OneArgument(std::move(result)); |
| 383 | 383 |
| 384 if (AppWindowRegistry::Get(browser_context()) | 384 if (AppWindowRegistry::Get(browser_context()) |
| 385 ->HadDevToolsAttached(app_window->web_contents())) { | 385 ->HadDevToolsAttached(app_window->web_contents())) { |
| 386 AppWindowClient::Get()->OpenDevToolsWindow( | 386 AppWindowClient::Get()->OpenDevToolsWindow( |
| 387 app_window->web_contents(), | 387 app_window->web_contents(), |
| 388 base::Bind(&AppWindowCreateFunction::Respond, this, | 388 base::Bind(&AppWindowCreateFunction::Respond, this, |
| 389 base::Passed(&result_arg))); | 389 base::Passed(&result_arg))); |
| 390 // OpenDevToolsWindow might have already responded. | 390 // OpenDevToolsWindow might have already responded. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 if (options.frame->as_frame_options->inactive_color.get()) { | 571 if (options.frame->as_frame_options->inactive_color.get()) { |
| 572 *error = app_window_constants::kInactiveColorWithoutColor; | 572 *error = app_window_constants::kInactiveColorWithoutColor; |
| 573 return false; | 573 return false; |
| 574 } | 574 } |
| 575 | 575 |
| 576 return true; | 576 return true; |
| 577 } | 577 } |
| 578 | 578 |
| 579 } // namespace extensions | 579 } // namespace extensions |
| OLD | NEW |