| 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 "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, | 83 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, |
| 84 base::Unretained(ResourceDispatcherHost::Get()), | 84 base::Unretained(ResourceDispatcherHost::Get()), |
| 85 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 85 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 ShellWindow::CreateParams::CreateParams() | 90 ShellWindow::CreateParams::CreateParams() |
| 91 : window_type(ShellWindow::WINDOW_TYPE_DEFAULT), | 91 : window_type(ShellWindow::WINDOW_TYPE_DEFAULT), |
| 92 frame(ShellWindow::FRAME_CHROME), | 92 frame(ShellWindow::FRAME_CHROME), |
| 93 bounds(INT_MIN, INT_MIN, INT_MIN, INT_MIN), | 93 bounds(INT_MIN, INT_MIN, 0, 0), |
| 94 creator_process_id(0), hidden(false) { | 94 creator_process_id(0), hidden(false) { |
| 95 } | 95 } |
| 96 | 96 |
| 97 ShellWindow::CreateParams::~CreateParams() { | 97 ShellWindow::CreateParams::~CreateParams() { |
| 98 } | 98 } |
| 99 | 99 |
| 100 ShellWindow* ShellWindow::Create(Profile* profile, | 100 ShellWindow* ShellWindow::Create(Profile* profile, |
| 101 const extensions::Extension* extension, | 101 const extensions::Extension* extension, |
| 102 const GURL& url, | 102 const GURL& url, |
| 103 const CreateParams& params) { | 103 const CreateParams& params) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 131 | 131 |
| 132 content::WebContentsObserver::Observe(web_contents_.get()); | 132 content::WebContentsObserver::Observe(web_contents_.get()); |
| 133 web_contents_->SetDelegate(this); | 133 web_contents_->SetDelegate(this); |
| 134 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); | 134 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); |
| 135 web_contents_->GetMutableRendererPrefs()-> | 135 web_contents_->GetMutableRendererPrefs()-> |
| 136 browser_handles_all_top_level_requests = true; | 136 browser_handles_all_top_level_requests = true; |
| 137 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 137 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
| 138 | 138 |
| 139 gfx::Rect bounds = params.bounds; | 139 gfx::Rect bounds = params.bounds; |
| 140 | 140 |
| 141 if (bounds.width() == INT_MIN) | 141 if (bounds.width() == 0) |
| 142 bounds.set_width(kDefaultWidth); | 142 bounds.set_width(kDefaultWidth); |
| 143 if (bounds.height() == INT_MIN) | 143 if (bounds.height() == 0) |
| 144 bounds.set_height(kDefaultHeight); | 144 bounds.set_height(kDefaultHeight); |
| 145 | 145 |
| 146 // If left and top are left undefined, the native shell window will center | 146 // If left and top are left undefined, the native shell window will center |
| 147 // the window on the main screen in a platform-defined manner. | 147 // the window on the main screen in a platform-defined manner. |
| 148 | 148 |
| 149 if (!params.window_key.empty()) { | 149 if (!params.window_key.empty()) { |
| 150 window_key_ = params.window_key; | 150 window_key_ = params.window_key; |
| 151 | 151 |
| 152 extensions::ShellWindowGeometryCache* cache = | 152 extensions::ShellWindowGeometryCache* cache = |
| 153 extensions::ExtensionSystem::Get(profile())-> | 153 extensions::ExtensionSystem::Get(profile())-> |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 const extensions::DraggableRegion& region = *iter; | 628 const extensions::DraggableRegion& region = *iter; |
| 629 sk_region->op( | 629 sk_region->op( |
| 630 region.bounds.x(), | 630 region.bounds.x(), |
| 631 region.bounds.y(), | 631 region.bounds.y(), |
| 632 region.bounds.right(), | 632 region.bounds.right(), |
| 633 region.bounds.bottom(), | 633 region.bounds.bottom(), |
| 634 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 634 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 635 } | 635 } |
| 636 return sk_region; | 636 return sk_region; |
| 637 } | 637 } |
| OLD | NEW |