| 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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
| 49 #include "content/public/browser/web_contents_view.h" | 49 #include "content/public/browser/web_contents_view.h" |
| 50 #include "content/public/browser/web_intents_dispatcher.h" | 50 #include "content/public/browser/web_intents_dispatcher.h" |
| 51 #include "grit/browser_resources.h" | 51 #include "grit/browser_resources.h" |
| 52 #include "grit/chromium_strings.h" | 52 #include "grit/chromium_strings.h" |
| 53 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
| 54 #include "ui/base/keycodes/keyboard_codes.h" | 54 #include "ui/base/keycodes/keyboard_codes.h" |
| 55 #include "ui/base/l10n/l10n_util.h" | 55 #include "ui/base/l10n/l10n_util.h" |
| 56 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
| 57 | 57 |
| 58 #if defined(OS_CHROMEOS) | |
| 59 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 60 #endif | |
| 61 | |
| 62 using WebKit::WebDragOperation; | 58 using WebKit::WebDragOperation; |
| 63 using WebKit::WebDragOperationsMask; | 59 using WebKit::WebDragOperationsMask; |
| 64 using content::NativeWebKeyboardEvent; | 60 using content::NativeWebKeyboardEvent; |
| 65 using content::OpenURLParams; | 61 using content::OpenURLParams; |
| 66 using content::RenderViewHost; | 62 using content::RenderViewHost; |
| 67 using content::SiteInstance; | 63 using content::SiteInstance; |
| 68 using content::WebContents; | 64 using content::WebContents; |
| 69 | 65 |
| 70 namespace extensions { | 66 namespace extensions { |
| 71 | 67 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // TODO(mpcomplete): is this check really necessary? | 403 // TODO(mpcomplete): is this check really necessary? |
| 408 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || | 404 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || |
| 409 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || | 405 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || |
| 410 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || | 406 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || |
| 411 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || | 407 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR || |
| 412 extension_host_type_ == chrome::VIEW_TYPE_PANEL) { | 408 extension_host_type_ == chrome::VIEW_TYPE_PANEL) { |
| 413 Close(); | 409 Close(); |
| 414 } | 410 } |
| 415 } | 411 } |
| 416 | 412 |
| 417 #if defined(OS_CHROMEOS) | |
| 418 bool ExtensionHost::ShouldSuppressDialogs() { | |
| 419 // Prevent extensions from creating dialogs while user session hasn't | |
| 420 // started yet. | |
| 421 return !chromeos::UserManager::Get()->IsSessionStarted(); | |
| 422 } | |
| 423 #endif | |
| 424 | |
| 425 void ExtensionHost::OnStartDownload( | 413 void ExtensionHost::OnStartDownload( |
| 426 content::WebContents* source, content::DownloadItem* download) { | 414 content::WebContents* source, content::DownloadItem* download) { |
| 427 // If |source| is in the context of a Browser, show the DownloadShelf on that | 415 // If |source| is in the context of a Browser, show the DownloadShelf on that |
| 428 // Browser. | 416 // Browser. |
| 429 if (!view() || !view()->browser()) | 417 if (!view() || !view()->browser()) |
| 430 return; | 418 return; |
| 431 static_cast<content::WebContentsDelegate*>(view()->browser())-> | 419 static_cast<content::WebContentsDelegate*>(view()->browser())-> |
| 432 OnStartDownload(source, download); | 420 OnStartDownload(source, download); |
| 433 } | 421 } |
| 434 | 422 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 void ExtensionHost::RequestMediaAccessPermission( | 644 void ExtensionHost::RequestMediaAccessPermission( |
| 657 content::WebContents* web_contents, | 645 content::WebContents* web_contents, |
| 658 const content::MediaStreamRequest* request, | 646 const content::MediaStreamRequest* request, |
| 659 const content::MediaResponseCallback& callback) { | 647 const content::MediaResponseCallback& callback) { |
| 660 // For tab capture device, we require the tabCapture permission. | 648 // For tab capture device, we require the tabCapture permission. |
| 661 RequestMediaAccessPermissionHelper::AuthorizeRequest( | 649 RequestMediaAccessPermissionHelper::AuthorizeRequest( |
| 662 request, callback, extension(), false); | 650 request, callback, extension(), false); |
| 663 } | 651 } |
| 664 | 652 |
| 665 } // namespace extensions | 653 } // namespace extensions |
| OLD | NEW |