| 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/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/shell_window_geometry_cache.h" | 10 #include "chrome/browser/extensions/shell_window_geometry_cache.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 base::Unretained(ResourceDispatcherHost::Get()), | 64 base::Unretained(ResourceDispatcherHost::Get()), |
| 65 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 65 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 ShellWindow::CreateParams::CreateParams() | 70 ShellWindow::CreateParams::CreateParams() |
| 71 : frame(ShellWindow::CreateParams::FRAME_CHROME), | 71 : frame(ShellWindow::CreateParams::FRAME_CHROME), |
| 72 bounds(-1, -1, kDefaultWidth, kDefaultHeight), | 72 bounds(-1, -1, kDefaultWidth, kDefaultHeight), |
| 73 restore_position(true), restore_size(true), | 73 restore_position(true), restore_size(true), |
| 74 creator_process_id(0) { | 74 creator_process_id(0), hidden(false) { |
| 75 } | 75 } |
| 76 | 76 |
| 77 ShellWindow::CreateParams::~CreateParams() { | 77 ShellWindow::CreateParams::~CreateParams() { |
| 78 } | 78 } |
| 79 | 79 |
| 80 ShellWindow* ShellWindow::Create(Profile* profile, | 80 ShellWindow* ShellWindow::Create(Profile* profile, |
| 81 const extensions::Extension* extension, | 81 const extensions::Extension* extension, |
| 82 const GURL& url, | 82 const GURL& url, |
| 83 const ShellWindow::CreateParams& params) { | 83 const ShellWindow::CreateParams& params) { |
| 84 // This object will delete itself when the window is closed. | 84 // This object will delete itself when the window is closed. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 | 108 |
| 109 content::WebContentsObserver::Observe(web_contents_.get()); | 109 content::WebContentsObserver::Observe(web_contents_.get()); |
| 110 web_contents_->SetDelegate(this); | 110 web_contents_->SetDelegate(this); |
| 111 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); | 111 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); |
| 112 web_contents_->GetMutableRendererPrefs()-> | 112 web_contents_->GetMutableRendererPrefs()-> |
| 113 browser_handles_all_top_level_requests = true; | 113 browser_handles_all_top_level_requests = true; |
| 114 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 114 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
| 115 | 115 |
| 116 native_window_.reset(NativeShellWindow::Create(this, params)); | 116 native_window_.reset(NativeShellWindow::Create(this, params)); |
| 117 | 117 |
| 118 if (!params.hidden) |
| 119 GetBaseWindow()->Show(); |
| 120 |
| 118 if (!params.window_key.empty()) { | 121 if (!params.window_key.empty()) { |
| 119 window_key_ = params.window_key; | 122 window_key_ = params.window_key; |
| 120 | 123 |
| 121 if (params.restore_position || params.restore_size) { | 124 if (params.restore_position || params.restore_size) { |
| 122 extensions::ShellWindowGeometryCache* cache = | 125 extensions::ShellWindowGeometryCache* cache = |
| 123 extensions::ExtensionSystem::Get(profile())-> | 126 extensions::ExtensionSystem::Get(profile())-> |
| 124 shell_window_geometry_cache(); | 127 shell_window_geometry_cache(); |
| 125 gfx::Rect cached_bounds; | 128 gfx::Rect cached_bounds; |
| 126 if (cache->GetGeometry(extension()->id(), params.window_key, | 129 if (cache->GetGeometry(extension()->id(), params.window_key, |
| 127 &cached_bounds)) { | 130 &cached_bounds)) { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 const extensions::DraggableRegion& region = *iter; | 494 const extensions::DraggableRegion& region = *iter; |
| 492 sk_region->op( | 495 sk_region->op( |
| 493 region.bounds.x(), | 496 region.bounds.x(), |
| 494 region.bounds.y(), | 497 region.bounds.y(), |
| 495 region.bounds.right(), | 498 region.bounds.right(), |
| 496 region.bounds.bottom(), | 499 region.bounds.bottom(), |
| 497 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 500 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 498 } | 501 } |
| 499 return sk_region; | 502 return sk_region; |
| 500 } | 503 } |
| OLD | NEW |