| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); | 248 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); |
| 249 WebContents* new_tab = browser->OpenURL(new_tab_params); | 249 WebContents* new_tab = browser->OpenURL(new_tab_params); |
| 250 browser->window()->Show(); | 250 browser->window()->Show(); |
| 251 return new_tab; | 251 return new_tab; |
| 252 } | 252 } |
| 253 | 253 |
| 254 void ShellWindow::AddNewContents(WebContents* source, | 254 void ShellWindow::AddNewContents(WebContents* source, |
| 255 WebContents* new_contents, | 255 WebContents* new_contents, |
| 256 WindowOpenDisposition disposition, | 256 WindowOpenDisposition disposition, |
| 257 const gfx::Rect& initial_pos, | 257 const gfx::Rect& initial_pos, |
| 258 bool user_gesture) { | 258 bool user_gesture, |
| 259 bool* was_blocked) { |
| 259 DCHECK(source == web_contents_); | 260 DCHECK(source == web_contents_); |
| 260 DCHECK(Profile::FromBrowserContext(new_contents->GetBrowserContext()) == | 261 DCHECK(Profile::FromBrowserContext(new_contents->GetBrowserContext()) == |
| 261 profile_); | 262 profile_); |
| 262 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); | 263 Browser* browser = browser::FindOrCreateTabbedBrowser(profile_); |
| 263 // Force all links to open in a new tab, even if they were trying to open a | 264 // Force all links to open in a new tab, even if they were trying to open a |
| 264 // new window. | 265 // new window. |
| 265 disposition = | 266 disposition = |
| 266 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 267 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
| 267 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos, | 268 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos, |
| 268 user_gesture); | 269 user_gesture, was_blocked); |
| 269 } | 270 } |
| 270 | 271 |
| 271 void ShellWindow::HandleKeyboardEvent( | 272 void ShellWindow::HandleKeyboardEvent( |
| 272 WebContents* source, | 273 WebContents* source, |
| 273 const content::NativeWebKeyboardEvent& event) { | 274 const content::NativeWebKeyboardEvent& event) { |
| 274 DCHECK_EQ(source, web_contents_); | 275 DCHECK_EQ(source, web_contents_); |
| 275 native_window_->HandleKeyboardEvent(event); | 276 native_window_->HandleKeyboardEvent(event); |
| 276 } | 277 } |
| 277 | 278 |
| 278 void ShellWindow::OnNativeClose() { | 279 void ShellWindow::OnNativeClose() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return; | 422 return; |
| 422 | 423 |
| 423 extensions::ShellWindowGeometryCache* cache = | 424 extensions::ShellWindowGeometryCache* cache = |
| 424 extensions::ExtensionSystem::Get(profile())-> | 425 extensions::ExtensionSystem::Get(profile())-> |
| 425 shell_window_geometry_cache(); | 426 shell_window_geometry_cache(); |
| 426 | 427 |
| 427 gfx::Rect bounds = native_window_->GetBounds(); | 428 gfx::Rect bounds = native_window_->GetBounds(); |
| 428 cache->SaveGeometry(extension()->id(), window_key_, bounds); | 429 cache->SaveGeometry(extension()->id(), window_key_, bounds); |
| 429 } | 430 } |
| 430 | 431 |
| OLD | NEW |