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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 void ShellWindow::Init(const GURL& url, | 125 void ShellWindow::Init(const GURL& url, |
126 const ShellWindow::CreateParams& params) { | 126 const ShellWindow::CreateParams& params) { |
127 window_type_ = params.window_type; | 127 window_type_ = params.window_type; |
128 | 128 |
129 web_contents_.reset(WebContents::Create(WebContents::CreateParams( | 129 web_contents_.reset(WebContents::Create(WebContents::CreateParams( |
130 profile(), SiteInstance::CreateForURL(profile(), url)))); | 130 profile(), SiteInstance::CreateForURL(profile(), url)))); |
131 WebContentsModalDialogManager::CreateForWebContents(web_contents_.get()); | 131 WebContentsModalDialogManager::CreateForWebContents(web_contents_.get()); |
132 FaviconTabHelper::CreateForWebContents(web_contents_.get()); | 132 FaviconTabHelper::CreateForWebContents(web_contents_.get()); |
| 133 #if defined(ENABLE_WEB_INTENTS) |
133 WebIntentPickerController::CreateForWebContents(web_contents_.get()); | 134 WebIntentPickerController::CreateForWebContents(web_contents_.get()); |
| 135 #endif |
134 | 136 |
135 content::WebContentsObserver::Observe(web_contents_.get()); | 137 content::WebContentsObserver::Observe(web_contents_.get()); |
136 web_contents_->SetDelegate(this); | 138 web_contents_->SetDelegate(this); |
137 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); | 139 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_APP_SHELL); |
138 web_contents_->GetMutableRendererPrefs()-> | 140 web_contents_->GetMutableRendererPrefs()-> |
139 browser_handles_all_top_level_requests = true; | 141 browser_handles_all_top_level_requests = true; |
140 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 142 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
141 | 143 |
142 gfx::Rect bounds = params.bounds; | 144 gfx::Rect bounds = params.bounds; |
143 | 145 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 native_app_window_->Close(); | 495 native_app_window_->Close(); |
494 } | 496 } |
495 | 497 |
496 bool ShellWindow::ShouldSuppressDialogs() { | 498 bool ShellWindow::ShouldSuppressDialogs() { |
497 return true; | 499 return true; |
498 } | 500 } |
499 | 501 |
500 void ShellWindow::WebIntentDispatch( | 502 void ShellWindow::WebIntentDispatch( |
501 content::WebContents* web_contents, | 503 content::WebContents* web_contents, |
502 content::WebIntentsDispatcher* intents_dispatcher) { | 504 content::WebIntentsDispatcher* intents_dispatcher) { |
| 505 #if defined(ENABLE_WEB_INTENTS) |
503 if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) | 506 if (!web_intents::IsWebIntentsEnabledForProfile(profile_)) |
504 return; | 507 return; |
505 | 508 |
506 WebIntentPickerController* web_intent_picker_controller = | 509 WebIntentPickerController* web_intent_picker_controller = |
507 WebIntentPickerController::FromWebContents(web_contents_.get()); | 510 WebIntentPickerController::FromWebContents(web_contents_.get()); |
508 web_intent_picker_controller->SetIntentsDispatcher(intents_dispatcher); | 511 web_intent_picker_controller->SetIntentsDispatcher(intents_dispatcher); |
509 web_intent_picker_controller->ShowDialog( | 512 web_intent_picker_controller->ShowDialog( |
510 intents_dispatcher->GetIntent().action, | 513 intents_dispatcher->GetIntent().action, |
511 intents_dispatcher->GetIntent().type); | 514 intents_dispatcher->GetIntent().type); |
| 515 #endif |
512 } | 516 } |
513 | 517 |
514 void ShellWindow::RunFileChooser(WebContents* tab, | 518 void ShellWindow::RunFileChooser(WebContents* tab, |
515 const content::FileChooserParams& params) { | 519 const content::FileChooserParams& params) { |
516 FileSelectHelper::RunFileChooser(tab, params); | 520 FileSelectHelper::RunFileChooser(tab, params); |
517 } | 521 } |
518 | 522 |
519 bool ShellWindow::IsPopupOrPanel(const WebContents* source) const { | 523 bool ShellWindow::IsPopupOrPanel(const WebContents* source) const { |
520 DCHECK(source == web_contents_.get()); | 524 DCHECK(source == web_contents_.get()); |
521 return true; | 525 return true; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 const extensions::DraggableRegion& region = *iter; | 636 const extensions::DraggableRegion& region = *iter; |
633 sk_region->op( | 637 sk_region->op( |
634 region.bounds.x(), | 638 region.bounds.x(), |
635 region.bounds.y(), | 639 region.bounds.y(), |
636 region.bounds.right(), | 640 region.bounds.right(), |
637 region.bounds.bottom(), | 641 region.bounds.bottom(), |
638 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 642 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
639 } | 643 } |
640 return sk_region; | 644 return sk_region; |
641 } | 645 } |
OLD | NEW |