OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/start_page_service.h" | 5 #include "chrome/browser/ui/app_list/start_page_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/ui/browser_navigator.h" | 31 #include "chrome/browser/ui/browser_navigator.h" |
32 #include "chrome/browser/ui/browser_navigator_params.h" | 32 #include "chrome/browser/ui/browser_navigator_params.h" |
33 #include "chrome/browser/ui/browser_tabstrip.h" | 33 #include "chrome/browser/ui/browser_tabstrip.h" |
34 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 34 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
38 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
39 #include "components/search_engines/template_url_prepopulate_data.h" | 39 #include "components/search_engines/template_url_prepopulate_data.h" |
40 #include "components/search_engines/template_url_service.h" | 40 #include "components/search_engines/template_url_service.h" |
41 #include "components/ui/zoom/zoom_controller.h" | 41 #include "components/zoom/zoom_controller.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/notification_details.h" | 43 #include "content/public/browser/notification_details.h" |
44 #include "content/public/browser/notification_observer.h" | 44 #include "content/public/browser/notification_observer.h" |
45 #include "content/public/browser/notification_registrar.h" | 45 #include "content/public/browser/notification_registrar.h" |
46 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
47 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
48 #include "content/public/browser/render_view_host.h" | 48 #include "content/public/browser/render_view_host.h" |
49 #include "content/public/browser/render_widget_host.h" | 49 #include "content/public/browser/render_widget_host.h" |
50 #include "content/public/browser/render_widget_host_view.h" | 50 #include "content/public/browser/render_widget_host_view.h" |
51 #include "content/public/browser/speech_recognition_session_preamble.h" | 51 #include "content/public/browser/speech_recognition_session_preamble.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 void StartPageService::DidNavigateMainFrame( | 575 void StartPageService::DidNavigateMainFrame( |
576 const content::LoadCommittedDetails& /*details*/, | 576 const content::LoadCommittedDetails& /*details*/, |
577 const content::FrameNavigateParams& /*params*/) { | 577 const content::FrameNavigateParams& /*params*/) { |
578 // Set the zoom level in DidNavigateMainFrame, as this is the earliest point | 578 // Set the zoom level in DidNavigateMainFrame, as this is the earliest point |
579 // at which it can be done and not be affected by the ZoomController's | 579 // at which it can be done and not be affected by the ZoomController's |
580 // DidNavigateMainFrame handler. | 580 // DidNavigateMainFrame handler. |
581 // | 581 // |
582 // Use a temporary zoom level for this web contents (aka isolated zoom | 582 // Use a temporary zoom level for this web contents (aka isolated zoom |
583 // mode) so changes to its zoom aren't reflected in any preferences. | 583 // mode) so changes to its zoom aren't reflected in any preferences. |
584 ui_zoom::ZoomController::FromWebContents(contents_.get()) | 584 zoom::ZoomController::FromWebContents(contents_.get()) |
585 ->SetZoomMode(ui_zoom::ZoomController::ZOOM_MODE_ISOLATED); | 585 ->SetZoomMode(zoom::ZoomController::ZOOM_MODE_ISOLATED); |
586 // Set to have a zoom level of 0, which corresponds to 100%, so the | 586 // Set to have a zoom level of 0, which corresponds to 100%, so the |
587 // contents aren't affected by the browser's default zoom level. | 587 // contents aren't affected by the browser's default zoom level. |
588 ui_zoom::ZoomController::FromWebContents(contents_.get())->SetZoomLevel(0); | 588 zoom::ZoomController::FromWebContents(contents_.get())->SetZoomLevel(0); |
589 } | 589 } |
590 | 590 |
591 void StartPageService::DidFailProvisionalLoad( | 591 void StartPageService::DidFailProvisionalLoad( |
592 content::RenderFrameHost* render_frame_host, | 592 content::RenderFrameHost* render_frame_host, |
593 const GURL& validated_url, | 593 const GURL& validated_url, |
594 int error_code, | 594 int error_code, |
595 const base::string16& error_description, | 595 const base::string16& error_description, |
596 bool was_ignored_by_handler) { | 596 bool was_ignored_by_handler) { |
597 // This avoids displaying a "Webpage Blocked" error or similar (which can | 597 // This avoids displaying a "Webpage Blocked" error or similar (which can |
598 // happen if the URL is blacklisted by enterprise policy). | 598 // happen if the URL is blacklisted by enterprise policy). |
(...skipping 18 matching lines...) Expand all Loading... |
617 | 617 |
618 void StartPageService::LoadContents() { | 618 void StartPageService::LoadContents() { |
619 contents_.reset(content::WebContents::Create( | 619 contents_.reset(content::WebContents::Create( |
620 content::WebContents::CreateParams(profile_))); | 620 content::WebContents::CreateParams(profile_))); |
621 contents_delegate_.reset(new StartPageWebContentsDelegate(profile_)); | 621 contents_delegate_.reset(new StartPageWebContentsDelegate(profile_)); |
622 contents_->SetDelegate(contents_delegate_.get()); | 622 contents_->SetDelegate(contents_delegate_.get()); |
623 | 623 |
624 // The ZoomController needs to be created before the web contents is observed | 624 // The ZoomController needs to be created before the web contents is observed |
625 // by this object. Otherwise it will react to DidNavigateMainFrame after this | 625 // by this object. Otherwise it will react to DidNavigateMainFrame after this |
626 // object does, resetting the zoom mode in the process. | 626 // object does, resetting the zoom mode in the process. |
627 ui_zoom::ZoomController::CreateForWebContents(contents_.get()); | 627 zoom::ZoomController::CreateForWebContents(contents_.get()); |
628 Observe(contents_.get()); | 628 Observe(contents_.get()); |
629 | 629 |
630 LoadStartPageURL(); | 630 LoadStartPageURL(); |
631 } | 631 } |
632 | 632 |
633 void StartPageService::UnloadContents() { | 633 void StartPageService::UnloadContents() { |
634 contents_.reset(); | 634 contents_.reset(); |
635 webui_finished_loading_ = false; | 635 webui_finished_loading_ = false; |
636 } | 636 } |
637 | 637 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 699 |
700 // Check for a new doodle. | 700 // Check for a new doodle. |
701 content::BrowserThread::PostDelayedTask( | 701 content::BrowserThread::PostDelayedTask( |
702 content::BrowserThread::UI, FROM_HERE, | 702 content::BrowserThread::UI, FROM_HERE, |
703 base::Bind(&StartPageService::FetchDoodleJson, | 703 base::Bind(&StartPageService::FetchDoodleJson, |
704 weak_factory_.GetWeakPtr()), | 704 weak_factory_.GetWeakPtr()), |
705 recheck_delay); | 705 recheck_delay); |
706 } | 706 } |
707 | 707 |
708 } // namespace app_list | 708 } // namespace app_list |
OLD | NEW |