| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 68 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 69 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, | 69 base::Bind(&ResourceDispatcherHost::BlockRequestsForRoute, |
| 70 base::Unretained(ResourceDispatcherHost::Get()), | 70 base::Unretained(ResourceDispatcherHost::Get()), |
| 71 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 71 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 ShellWindow::CreateParams::CreateParams() | 76 ShellWindow::CreateParams::CreateParams() |
| 77 : frame(ShellWindow::CreateParams::FRAME_CHROME), | 77 : frame(ShellWindow::CreateParams::FRAME_CHROME), |
| 78 bounds(INT_MIN, INT_MIN, 0, 0), | 78 bounds(INT_MIN, INT_MIN, INT_MIN, INT_MIN), |
| 79 restore_position(true), restore_size(true), | 79 restore_position(true), restore_size(true), |
| 80 creator_process_id(0), hidden(false) { | 80 creator_process_id(0), hidden(false) { |
| 81 } | 81 } |
| 82 | 82 |
| 83 ShellWindow::CreateParams::~CreateParams() { | 83 ShellWindow::CreateParams::~CreateParams() { |
| 84 } | 84 } |
| 85 | 85 |
| 86 ShellWindow* ShellWindow::Create(Profile* profile, | 86 ShellWindow* ShellWindow::Create(Profile* profile, |
| 87 const extensions::Extension* extension, | 87 const extensions::Extension* extension, |
| 88 const GURL& url, | 88 const GURL& url, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 115 | 115 |
| 116 content::WebContentsObserver::Observe(web_contents_.get()); | 116 content::WebContentsObserver::Observe(web_contents_.get()); |
| 117 web_contents_->SetDelegate(this); | 117 web_contents_->SetDelegate(this); |
| 118 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); | 118 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); |
| 119 web_contents_->GetMutableRendererPrefs()-> | 119 web_contents_->GetMutableRendererPrefs()-> |
| 120 browser_handles_all_top_level_requests = true; | 120 browser_handles_all_top_level_requests = true; |
| 121 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 121 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
| 122 | 122 |
| 123 gfx::Rect bounds = params.bounds; | 123 gfx::Rect bounds = params.bounds; |
| 124 | 124 |
| 125 if (bounds.width() == 0) | 125 if (bounds.width() == INT_MIN) |
| 126 bounds.set_width(kDefaultWidth); | 126 bounds.set_width(kDefaultWidth); |
| 127 if (bounds.height() == 0) | 127 if (bounds.height() == INT_MIN) |
| 128 bounds.set_height(kDefaultHeight); | 128 bounds.set_height(kDefaultHeight); |
| 129 | 129 |
| 130 // If left and top are left undefined, the native shell window will center | 130 // If left and top are left undefined, the native shell window will center |
| 131 // the window on the main screen in a platform-defined manner. | 131 // the window on the main screen in a platform-defined manner. |
| 132 | 132 |
| 133 if (!params.window_key.empty()) { | 133 if (!params.window_key.empty()) { |
| 134 window_key_ = params.window_key; | 134 window_key_ = params.window_key; |
| 135 | 135 |
| 136 if (params.restore_position || params.restore_size) { | 136 if (params.restore_position || params.restore_size) { |
| 137 extensions::ShellWindowGeometryCache* cache = | 137 extensions::ShellWindowGeometryCache* cache = |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 const extensions::DraggableRegion& region = *iter; | 514 const extensions::DraggableRegion& region = *iter; |
| 515 sk_region->op( | 515 sk_region->op( |
| 516 region.bounds.x(), | 516 region.bounds.x(), |
| 517 region.bounds.y(), | 517 region.bounds.y(), |
| 518 region.bounds.right(), | 518 region.bounds.right(), |
| 519 region.bounds.bottom(), | 519 region.bounds.bottom(), |
| 520 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 520 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 521 } | 521 } |
| 522 return sk_region; | 522 return sk_region; |
| 523 } | 523 } |
| OLD | NEW |