OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "base/threading/thread_restrictions.h" | 29 #include "base/threading/thread_restrictions.h" |
30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
32 #include "chrome/app/chrome_command_ids.h" | 32 #include "chrome/app/chrome_command_ids.h" |
33 #include "chrome/browser/app_mode/app_mode_utils.h" | 33 #include "chrome/browser/app_mode/app_mode_utils.h" |
34 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 34 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
35 #include "chrome/browser/background/background_contents.h" | 35 #include "chrome/browser/background/background_contents.h" |
36 #include "chrome/browser/background/background_contents_service.h" | 36 #include "chrome/browser/background/background_contents_service.h" |
37 #include "chrome/browser/background/background_contents_service_factory.h" | 37 #include "chrome/browser/background/background_contents_service_factory.h" |
38 #include "chrome/browser/banners/app_banner_manager_desktop.h" | 38 #include "chrome/browser/banners/app_banner_manager_desktop.h" |
39 #include "chrome/browser/banners/app_banner_manager_emulation.h" | |
40 #include "chrome/browser/browser_process.h" | 39 #include "chrome/browser/browser_process.h" |
41 #include "chrome/browser/browser_shutdown.h" | 40 #include "chrome/browser/browser_shutdown.h" |
42 #include "chrome/browser/character_encoding.h" | 41 #include "chrome/browser/character_encoding.h" |
43 #include "chrome/browser/chrome_notification_types.h" | 42 #include "chrome/browser/chrome_notification_types.h" |
44 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 43 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
45 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 44 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
46 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 45 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
47 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re
quest.h" | 46 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re
quest.h" |
48 #include "chrome/browser/defaults.h" | 47 #include "chrome/browser/defaults.h" |
49 #include "chrome/browser/devtools/devtools_toggle_action.h" | 48 #include "chrome/browser/devtools/devtools_toggle_action.h" |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 Browser* browser = chrome::FindBrowserWithWebContents( | 1440 Browser* browser = chrome::FindBrowserWithWebContents( |
1442 WebContents::FromRenderFrameHost(frame)); | 1441 WebContents::FromRenderFrameHost(frame)); |
1443 BubbleReference bubble_reference = | 1442 BubbleReference bubble_reference = |
1444 browser->GetBubbleManager()->ShowBubble(std::move(bubble_controller)); | 1443 browser->GetBubbleManager()->ShowBubble(std::move(bubble_controller)); |
1445 bubble_controller_ptr->set_bubble_reference(bubble_reference); | 1444 bubble_controller_ptr->set_bubble_reference(bubble_reference); |
1446 | 1445 |
1447 return std::move(bluetooth_chooser_desktop); | 1446 return std::move(bluetooth_chooser_desktop); |
1448 } | 1447 } |
1449 | 1448 |
1450 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { | 1449 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { |
1451 banners::AppBannerManagerEmulation::CreateForWebContents(web_contents); | 1450 banners::AppBannerManagerDesktop::CreateForWebContents(web_contents); |
1452 banners::AppBannerManagerEmulation* manager = | 1451 RequestAppBanner(web_contents); |
1453 banners::AppBannerManagerEmulation::FromWebContents(web_contents); | 1452 } |
1454 manager->RequestAppBanner(web_contents->GetMainFrame(), | 1453 |
1455 web_contents->GetLastCommittedURL(), true); | 1454 bool Browser::RequestAppBanner(content::WebContents* web_contents) { |
| 1455 banners::AppBannerManagerDesktop* manager = |
| 1456 banners::AppBannerManagerDesktop::FromWebContents(web_contents); |
| 1457 if (manager) { |
| 1458 manager->RequestAppBanner(web_contents->GetMainFrame(), |
| 1459 web_contents->GetLastCommittedURL(), true); |
| 1460 return true; |
| 1461 } |
| 1462 |
| 1463 web_contents->GetMainFrame()->AddMessageToConsole( |
| 1464 content::CONSOLE_MESSAGE_LEVEL_DEBUG, |
| 1465 "App banners are currently disabled. Please check chrome://flags/#" + |
| 1466 std::string(switches::kEnableAddToShelf)); |
| 1467 return false; |
1456 } | 1468 } |
1457 | 1469 |
1458 bool Browser::IsMouseLocked() const { | 1470 bool Browser::IsMouseLocked() const { |
1459 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); | 1471 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); |
1460 } | 1472 } |
1461 | 1473 |
1462 void Browser::OnWindowDidShow() { | 1474 void Browser::OnWindowDidShow() { |
1463 if (window_has_shown_) | 1475 if (window_has_shown_) |
1464 return; | 1476 return; |
1465 window_has_shown_ = true; | 1477 window_has_shown_ = true; |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 if (contents && !allow_js_access) { | 2745 if (contents && !allow_js_access) { |
2734 contents->web_contents()->GetController().LoadURL( | 2746 contents->web_contents()->GetController().LoadURL( |
2735 target_url, | 2747 target_url, |
2736 content::Referrer(), | 2748 content::Referrer(), |
2737 ui::PAGE_TRANSITION_LINK, | 2749 ui::PAGE_TRANSITION_LINK, |
2738 std::string()); // No extra headers. | 2750 std::string()); // No extra headers. |
2739 } | 2751 } |
2740 | 2752 |
2741 return contents != NULL; | 2753 return contents != NULL; |
2742 } | 2754 } |
OLD | NEW |