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