Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/instant/instant_loader.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/instant/instant_loader.h" 5 #include "chrome/browser/instant/instant_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/i18n/case_conversion.h" 13 #include "base/i18n/case_conversion.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/favicon/favicon_service.h" 18 #include "chrome/browser/favicon/favicon_service.h"
19 #include "chrome/browser/history/history_marshaling.h" 19 #include "chrome/browser/history/history_marshaling.h"
20 #include "chrome/browser/history/history_tab_helper.h" 20 #include "chrome/browser/history/history_tab_helper.h"
21 #include "chrome/browser/instant/instant_loader_delegate.h" 21 #include "chrome/browser/instant/instant_loader_delegate.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/search_engines/template_url.h" 23 #include "chrome/browser/search_engines/template_url.h"
24 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 24 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
25 #include "chrome/browser/ui/download/download_tab_helper.h" 25 #include "chrome/browser/ui/download/download_tab_helper.h"
26 #include "chrome/browser/ui/download/download_tab_helper_delegate.h" 26 #include "chrome/browser/ui/download/download_tab_helper_delegate.h"
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
29 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/render_messages.h" 31 #include "chrome/common/render_messages.h"
31 #include "content/browser/renderer_host/render_view_host.h" 32 #include "content/browser/renderer_host/render_view_host.h"
32 #include "content/browser/renderer_host/render_widget_host.h" 33 #include "content/browser/renderer_host/render_widget_host.h"
33 #include "content/browser/renderer_host/render_widget_host_view.h" 34 #include "content/browser/renderer_host/render_widget_host_view.h"
34 #include "content/browser/tab_contents/navigation_details.h" 35 #include "content/browser/tab_contents/navigation_details.h"
35 #include "content/browser/tab_contents/navigation_entry.h" 36 #include "content/browser/tab_contents/navigation_entry.h"
36 #include "content/browser/tab_contents/provisional_load_details.h" 37 #include "content/browser/tab_contents/provisional_load_details.h"
37 #include "content/browser/tab_contents/tab_contents.h" 38 #include "content/browser/tab_contents/tab_contents.h"
38 #include "content/browser/tab_contents/tab_contents_delegate.h" 39 #include "content/browser/tab_contents/tab_contents_delegate.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined( 545 void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined(
545 int32 page_id, 546 int32 page_id,
546 bool result) { 547 bool result) {
547 TabContents* source = loader_->preview_contents()->tab_contents(); 548 TabContents* source = loader_->preview_contents()->tab_contents();
548 if (!source->controller().GetActiveEntry() || 549 if (!source->controller().GetActiveEntry() ||
549 page_id != source->controller().GetActiveEntry()->page_id()) 550 page_id != source->controller().GetActiveEntry()->page_id())
550 return; 551 return;
551 552
552 Details<const bool> details(&result); 553 Details<const bool> details(&result);
553 NotificationService::current()->Notify( 554 NotificationService::current()->Notify(
554 NotificationType::INSTANT_SUPPORT_DETERMINED, 555 chrome::INSTANT_SUPPORT_DETERMINED,
555 NotificationService::AllSources(), 556 NotificationService::AllSources(),
556 details); 557 details);
557 558
558 if (result) 559 if (result)
559 loader_->PageFinishedLoading(); 560 loader_->PageFinishedLoading();
560 else 561 else
561 loader_->PageDoesntSupportInstant(user_typed_before_load_); 562 loader_->PageDoesntSupportInstant(user_typed_before_load_);
562 } 563 }
563 564
564 void InstantLoader::TabContentsDelegateImpl 565 void InstantLoader::TabContentsDelegateImpl
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 preview_tab_contents_delegate_->SetLastHistoryURLAndPrune(url); 741 preview_tab_contents_delegate_->SetLastHistoryURLAndPrune(url);
741 } 742 }
742 preview_tab_contents_delegate_->CommitHistory(template_url_id_ != 0); 743 preview_tab_contents_delegate_->CommitHistory(template_url_id_ != 0);
743 } 744 }
744 if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) { 745 if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) {
745 #if defined(OS_MACOSX) 746 #if defined(OS_MACOSX)
746 preview_contents_->tab_contents()->GetRenderWidgetHostView()-> 747 preview_contents_->tab_contents()->GetRenderWidgetHostView()->
747 SetTakesFocusOnlyOnMouseDown(false); 748 SetTakesFocusOnlyOnMouseDown(false);
748 registrar_.Remove( 749 registrar_.Remove(
749 this, 750 this,
750 NotificationType::RENDER_VIEW_HOST_CHANGED, 751 chrome::RENDER_VIEW_HOST_CHANGED,
751 Source<NavigationController>(&preview_contents_->controller())); 752 Source<NavigationController>(&preview_contents_->controller()));
752 #endif 753 #endif
753 } 754 }
754 preview_contents_->tab_contents()->set_delegate(NULL); 755 preview_contents_->tab_contents()->set_delegate(NULL);
755 preview_contents_->download_tab_helper()->set_delegate(NULL); 756 preview_contents_->download_tab_helper()->set_delegate(NULL);
756 ready_ = false; 757 ready_ = false;
757 } 758 }
758 update_bounds_timer_.Stop(); 759 update_bounds_timer_.Stop();
759 return preview_contents_.release(); 760 return preview_contents_.release();
760 } 761 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 if (!ready_) { 851 if (!ready_) {
851 ready_ = true; 852 ready_ = true;
852 delegate_->InstantStatusChanged(this); 853 delegate_->InstantStatusChanged(this);
853 } 854 }
854 } 855 }
855 856
856 void InstantLoader::Observe(NotificationType type, 857 void InstantLoader::Observe(NotificationType type,
857 const NotificationSource& source, 858 const NotificationSource& source,
858 const NotificationDetails& details) { 859 const NotificationDetails& details) {
859 #if defined(OS_MACOSX) 860 #if defined(OS_MACOSX)
860 if (type.value == NotificationType::RENDER_VIEW_HOST_CHANGED) { 861 if (type.value == chrome::RENDER_VIEW_HOST_CHANGED) {
861 if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) { 862 if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) {
862 preview_contents_->tab_contents()->GetRenderWidgetHostView()-> 863 preview_contents_->tab_contents()->GetRenderWidgetHostView()->
863 SetTakesFocusOnlyOnMouseDown(true); 864 SetTakesFocusOnlyOnMouseDown(true);
864 } 865 }
865 return; 866 return;
866 } 867 }
867 #endif 868 #endif
868 if (type.value == NotificationType::NAV_ENTRY_COMMITTED) { 869 if (type.value == NotificationType::NAV_ENTRY_COMMITTED) {
869 content::LoadCommittedDetails* load_details = 870 content::LoadCommittedDetails* load_details =
870 Details<content::LoadCommittedDetails>(details).ptr(); 871 Details<content::LoadCommittedDetails>(details).ptr();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 CommandLine* cl = CommandLine::ForCurrentProcess(); 1041 CommandLine* cl = CommandLine::ForCurrentProcess();
1041 if (cl->HasSwitch(switches::kInstantURL)) 1042 if (cl->HasSwitch(switches::kInstantURL))
1042 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1043 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1043 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); 1044 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type);
1044 RenderViewHost* host = preview_contents_->render_view_host(); 1045 RenderViewHost* host = preview_contents_->render_view_host();
1045 host->Send(new ViewMsg_SearchBoxChange( 1046 host->Send(new ViewMsg_SearchBoxChange(
1046 host->routing_id(), user_text, verbatim, 0, 0)); 1047 host->routing_id(), user_text, verbatim, 0, 0));
1047 frame_load_observer_.reset(new FrameLoadObserver( 1048 frame_load_observer_.reset(new FrameLoadObserver(
1048 this, preview_contents()->tab_contents(), user_text, verbatim)); 1049 this, preview_contents()->tab_contents(), user_text, verbatim));
1049 } 1050 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698