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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_contents.h" | 8 #include "apps/app_window_contents.h" |
9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
10 #include "apps/ui/apps_client.h" | 10 #include "apps/ui/apps_client.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is | 66 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is |
67 // ready to stop on breakpoints in the callback. | 67 // ready to stop on breakpoints in the callback. |
68 class DevToolsRestorer : public base::RefCounted<DevToolsRestorer> { | 68 class DevToolsRestorer : public base::RefCounted<DevToolsRestorer> { |
69 public: | 69 public: |
70 DevToolsRestorer(AppWindowCreateFunction* delayed_create_function, | 70 DevToolsRestorer(AppWindowCreateFunction* delayed_create_function, |
71 content::RenderViewHost* created_view) | 71 content::RenderViewHost* created_view) |
72 : delayed_create_function_(delayed_create_function) { | 72 : delayed_create_function_(delayed_create_function) { |
73 AddRef(); // Balanced in LoadCompleted. | 73 AddRef(); // Balanced in LoadCompleted. |
74 DevToolsWindow* devtools_window = | 74 DevToolsWindow* devtools_window = |
75 DevToolsWindow::OpenDevToolsWindow( | 75 DevToolsWindow::OpenDevToolsWindow( |
76 created_view, | 76 content::WebContents::FromRenderViewHost(created_view), |
77 DevToolsToggleAction::ShowConsole()); | 77 DevToolsToggleAction::ShowConsole()); |
78 devtools_window->SetLoadCompletedCallback( | 78 devtools_window->SetLoadCompletedCallback( |
79 base::Bind(&DevToolsRestorer::LoadCompleted, this)); | 79 base::Bind(&DevToolsRestorer::LoadCompleted, this)); |
80 } | 80 } |
81 | 81 |
82 private: | 82 private: |
83 friend class base::RefCounted<DevToolsRestorer>; | 83 friend class base::RefCounted<DevToolsRestorer>; |
84 ~DevToolsRestorer() {} | 84 ~DevToolsRestorer() {} |
85 | 85 |
86 void LoadCompleted() { | 86 void LoadCompleted() { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 base::DictionaryValue* result = new base::DictionaryValue; | 300 base::DictionaryValue* result = new base::DictionaryValue; |
301 result->Set("viewId", new base::FundamentalValue(view_id)); | 301 result->Set("viewId", new base::FundamentalValue(view_id)); |
302 result->Set("injectTitlebar", | 302 result->Set("injectTitlebar", |
303 new base::FundamentalValue(inject_html_titlebar_)); | 303 new base::FundamentalValue(inject_html_titlebar_)); |
304 result->Set("id", new base::StringValue(app_window->window_key())); | 304 result->Set("id", new base::StringValue(app_window->window_key())); |
305 app_window->GetSerializedState(result); | 305 app_window->GetSerializedState(result); |
306 SetResult(result); | 306 SetResult(result); |
307 | 307 |
308 if (apps::AppWindowRegistry::Get(browser_context()) | 308 if (apps::AppWindowRegistry::Get(browser_context()) |
309 ->HadDevToolsAttached(created_view)) { | 309 ->HadDevToolsAttached(created_view)) { |
310 new DevToolsRestorer(this, created_view); | 310 new DevToolsRestorer(this, created_view); |
dgozman
2014/08/06 13:06:09
Passing WebContents here would be more clear.
pfeldman
2014/08/06 16:26:35
Done.
| |
311 return true; | 311 return true; |
312 } | 312 } |
313 | 313 |
314 SendResponse(true); | 314 SendResponse(true); |
315 app_window->WindowEventsReady(); | 315 app_window->WindowEventsReady(); |
316 | 316 |
317 return true; | 317 return true; |
318 } | 318 } |
319 | 319 |
320 bool AppWindowCreateFunction::GetBoundsSpec( | 320 bool AppWindowCreateFunction::GetBoundsSpec( |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 | 492 |
493 if (options.frame->as_frame_options->inactive_color.get()) { | 493 if (options.frame->as_frame_options->inactive_color.get()) { |
494 error_ = app_window_constants::kInactiveColorWithoutColor; | 494 error_ = app_window_constants::kInactiveColorWithoutColor; |
495 return false; | 495 return false; |
496 } | 496 } |
497 | 497 |
498 return true; | 498 return true; |
499 } | 499 } |
500 | 500 |
501 } // namespace extensions | 501 } // namespace extensions |
OLD | NEW |