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

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

Issue 7631063: Prefix all IPC messages used by src\chrome with Chrome. For e.g ChromeViewMsg_, ChromeViewHostMsg... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « chrome/browser/history/history_tab_helper.cc ('k') | chrome/browser/memory_purger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 NavigationEntry* active_entry = 123 NavigationEntry* active_entry =
124 tab_contents_->controller().GetActiveEntry(); 124 tab_contents_->controller().GetActiveEntry();
125 if (!active_entry || active_entry->page_id() != page_id || 125 if (!active_entry || active_entry->page_id() != page_id ||
126 active_entry->unique_id() != unique_id_) { 126 active_entry->unique_id() != unique_id_) {
127 return; 127 return;
128 } 128 }
129 loader_->SendBoundsToPage(true); 129 loader_->SendBoundsToPage(true);
130 // TODO: support real cursor position. 130 // TODO: support real cursor position.
131 int text_length = static_cast<int>(text_.size()); 131 int text_length = static_cast<int>(text_.size());
132 RenderViewHost* host = tab_contents_->render_view_host(); 132 RenderViewHost* host = tab_contents_->render_view_host();
133 host->Send(new ViewMsg_DetermineIfPageSupportsInstant( 133 host->Send(new ChromeViewMsg_DetermineIfPageSupportsInstant(
134 host->routing_id(), text_, verbatim_, text_length, text_length)); 134 host->routing_id(), text_, verbatim_, text_length, text_length));
135 break; 135 break;
136 } 136 }
137 default: 137 default:
138 NOTREACHED(); 138 NOTREACHED();
139 break; 139 break;
140 } 140 }
141 } 141 }
142 142
143 // TabContentsDelegateImpl ----------------------------------------------------- 143 // TabContentsDelegateImpl -----------------------------------------------------
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 TabContentsWrapper* old_tc, 501 TabContentsWrapper* old_tc,
502 TabContentsWrapper* new_tc) { 502 TabContentsWrapper* new_tc) {
503 loader_->ReplacePreviewContents(old_tc, new_tc); 503 loader_->ReplacePreviewContents(old_tc, new_tc);
504 } 504 }
505 505
506 506
507 bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived( 507 bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived(
508 const IPC::Message& message) { 508 const IPC::Message& message) {
509 bool handled = true; 509 bool handled = true;
510 IPC_BEGIN_MESSAGE_MAP(TabContentsDelegateImpl, message) 510 IPC_BEGIN_MESSAGE_MAP(TabContentsDelegateImpl, message)
511 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) 511 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
512 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, 512 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
513 OnInstantSupportDetermined) 513 OnInstantSupportDetermined)
514 IPC_MESSAGE_UNHANDLED(handled = false) 514 IPC_MESSAGE_UNHANDLED(handled = false)
515 IPC_END_MESSAGE_MAP() 515 IPC_END_MESSAGE_MAP()
516 return handled; 516 return handled;
517 } 517 }
518 518
519 void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions( 519 void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions(
520 int32 page_id, 520 int32 page_id,
521 const std::vector<std::string>& suggestions, 521 const std::vector<std::string>& suggestions,
522 InstantCompleteBehavior behavior) { 522 InstantCompleteBehavior behavior) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (is_waiting_for_load()) { 632 if (is_waiting_for_load()) {
633 // The page hasn't loaded yet. We'll send the script down when it does. 633 // The page hasn't loaded yet. We'll send the script down when it does.
634 frame_load_observer_->set_text(user_text_); 634 frame_load_observer_->set_text(user_text_);
635 frame_load_observer_->set_verbatim(verbatim); 635 frame_load_observer_->set_verbatim(verbatim);
636 preview_tab_contents_delegate_->set_user_typed_before_load(); 636 preview_tab_contents_delegate_->set_user_typed_before_load();
637 return true; 637 return true;
638 } 638 }
639 // TODO: support real cursor position. 639 // TODO: support real cursor position.
640 int text_length = static_cast<int>(user_text_.size()); 640 int text_length = static_cast<int>(user_text_.size());
641 RenderViewHost* host = preview_contents_->render_view_host(); 641 RenderViewHost* host = preview_contents_->render_view_host();
642 host->Send(new ViewMsg_SearchBoxChange( 642 host->Send(new ChromeViewMsg_SearchBoxChange(
643 host->routing_id(), user_text_, verbatim, text_length, text_length)); 643 host->routing_id(), user_text_, verbatim, text_length, text_length));
644 644
645 string16 complete_suggested_text_lower = base::i18n::ToLower( 645 string16 complete_suggested_text_lower = base::i18n::ToLower(
646 complete_suggested_text_); 646 complete_suggested_text_);
647 string16 user_text_lower = base::i18n::ToLower(user_text_); 647 string16 user_text_lower = base::i18n::ToLower(user_text_);
648 if (!verbatim && 648 if (!verbatim &&
649 complete_suggested_text_lower.size() > user_text_lower.size() && 649 complete_suggested_text_lower.size() > user_text_lower.size() &&
650 !complete_suggested_text_lower.compare(0, user_text_lower.size(), 650 !complete_suggested_text_lower.compare(0, user_text_lower.size(),
651 user_text_lower)) { 651 user_text_lower)) {
652 *suggested_text = last_suggestion_ = 652 *suggested_text = last_suggestion_ =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 if (!preview_contents_.get()) 701 if (!preview_contents_.get())
702 return NULL; 702 return NULL;
703 703
704 // FrameLoadObserver is only used for instant results, and instant results are 704 // FrameLoadObserver is only used for instant results, and instant results are
705 // only committed if active (when the FrameLoadObserver isn't installed). 705 // only committed if active (when the FrameLoadObserver isn't installed).
706 DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get()); 706 DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get());
707 707
708 if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) { 708 if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) {
709 RenderViewHost* host = preview_contents_->render_view_host(); 709 RenderViewHost* host = preview_contents_->render_view_host();
710 if (type == INSTANT_COMMIT_FOCUS_LOST) { 710 if (type == INSTANT_COMMIT_FOCUS_LOST) {
711 host->Send(new ViewMsg_SearchBoxCancel(host->routing_id())); 711 host->Send(new ChromeViewMsg_SearchBoxCancel(host->routing_id()));
712 } else { 712 } else {
713 host->Send(new ViewMsg_SearchBoxSubmit( 713 host->Send(new ChromeViewMsg_SearchBoxSubmit(
714 host->routing_id(), user_text_, 714 host->routing_id(), user_text_,
715 type == INSTANT_COMMIT_PRESSED_ENTER)); 715 type == INSTANT_COMMIT_PRESSED_ENTER));
716 } 716 }
717 } 717 }
718 omnibox_bounds_ = gfx::Rect(); 718 omnibox_bounds_ = gfx::Rect();
719 last_omnibox_bounds_ = gfx::Rect(); 719 last_omnibox_bounds_ = gfx::Rect();
720 GURL url; 720 GURL url;
721 url.Swap(&url_); 721 url.Swap(&url_);
722 user_text_.clear(); 722 user_text_.clear();
723 complete_suggested_text_.clear(); 723 complete_suggested_text_.clear();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 916 }
917 917
918 void InstantLoader::SendBoundsToPage(bool force_if_waiting) { 918 void InstantLoader::SendBoundsToPage(bool force_if_waiting) {
919 if (last_omnibox_bounds_ == omnibox_bounds_) 919 if (last_omnibox_bounds_ == omnibox_bounds_)
920 return; 920 return;
921 921
922 if (preview_contents_.get() && is_showing_instant() && 922 if (preview_contents_.get() && is_showing_instant() &&
923 (force_if_waiting || !is_waiting_for_load())) { 923 (force_if_waiting || !is_waiting_for_load())) {
924 last_omnibox_bounds_ = omnibox_bounds_; 924 last_omnibox_bounds_ = omnibox_bounds_;
925 RenderViewHost* host = preview_contents_->render_view_host(); 925 RenderViewHost* host = preview_contents_->render_view_host();
926 host->Send(new ViewMsg_SearchBoxResize( 926 host->Send(new ChromeViewMsg_SearchBoxResize(
927 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); 927 host->routing_id(), GetOmniboxBoundsInTermsOfPreview()));
928 } 928 }
929 } 929 }
930 930
931 void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc, 931 void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc,
932 TabContentsWrapper* new_tc) { 932 TabContentsWrapper* new_tc) {
933 DCHECK(old_tc == preview_contents_); 933 DCHECK(old_tc == preview_contents_);
934 // We release here without deleting so that the caller still has reponsibility 934 // We release here without deleting so that the caller still has reponsibility
935 // for deleting the TabContentsWrapper. 935 // for deleting the TabContentsWrapper.
936 ignore_result(preview_contents_.release()); 936 ignore_result(preview_contents_.release());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 // functionality so that embeded tags (like {google:baseURL}) are escaped 1023 // functionality so that embeded tags (like {google:baseURL}) are escaped
1024 // correctly. 1024 // correctly.
1025 // TODO(sky): having to use a replaceable url is a bit of a hack here. 1025 // TODO(sky): having to use a replaceable url is a bit of a hack here.
1026 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( 1026 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile(
1027 tab_contents->profile(), *template_url, string16(), -1, string16())); 1027 tab_contents->profile(), *template_url, string16(), -1, string16()));
1028 CommandLine* cl = CommandLine::ForCurrentProcess(); 1028 CommandLine* cl = CommandLine::ForCurrentProcess();
1029 if (cl->HasSwitch(switches::kInstantURL)) 1029 if (cl->HasSwitch(switches::kInstantURL))
1030 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1030 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1031 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); 1031 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type);
1032 RenderViewHost* host = preview_contents_->render_view_host(); 1032 RenderViewHost* host = preview_contents_->render_view_host();
1033 host->Send(new ViewMsg_SearchBoxChange( 1033 host->Send(new ChromeViewMsg_SearchBoxChange(
1034 host->routing_id(), user_text, verbatim, 0, 0)); 1034 host->routing_id(), user_text, verbatim, 0, 0));
1035 frame_load_observer_.reset(new FrameLoadObserver( 1035 frame_load_observer_.reset(new FrameLoadObserver(
1036 this, preview_contents()->tab_contents(), user_text, verbatim)); 1036 this, preview_contents()->tab_contents(), user_text, verbatim));
1037 } 1037 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_tab_helper.cc ('k') | chrome/browser/memory_purger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698