| 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/search/instant_overlay.h" | 5 #include "chrome/browser/ui/search/instant_overlay.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 #include "chrome/browser/search/search.h" | 9 #include "chrome/browser/search/search.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 InstantOverlay* InstantOverlay::FromWebContents( | 35 InstantOverlay* InstantOverlay::FromWebContents( |
| 36 const content::WebContents* web_contents) { | 36 const content::WebContents* web_contents) { |
| 37 InstantOverlayUserData* data = static_cast<InstantOverlayUserData*>( | 37 InstantOverlayUserData* data = static_cast<InstantOverlayUserData*>( |
| 38 web_contents->GetUserData(&kUserDataKey)); | 38 web_contents->GetUserData(&kUserDataKey)); |
| 39 return data ? data->overlay() : NULL; | 39 return data ? data->overlay() : NULL; |
| 40 } | 40 } |
| 41 | 41 |
| 42 InstantOverlay::InstantOverlay(InstantController* controller, | 42 InstantOverlay::InstantOverlay(InstantController* controller, |
| 43 const std::string& instant_url) | 43 const std::string& instant_url, |
| 44 : InstantPage(controller, instant_url), | 44 bool is_incognito) |
| 45 : InstantPage(controller, instant_url, is_incognito), |
| 45 loader_(this), | 46 loader_(this), |
| 46 is_stale_(false), | 47 is_stale_(false), |
| 47 is_pointer_down_from_activate_(false) { | 48 is_pointer_down_from_activate_(false) { |
| 48 } | 49 } |
| 49 | 50 |
| 50 InstantOverlay::~InstantOverlay() { | 51 InstantOverlay::~InstantOverlay() { |
| 51 } | 52 } |
| 52 | 53 |
| 53 void InstantOverlay::InitContents(Profile* profile, | 54 void InstantOverlay::InitContents(Profile* profile, |
| 54 const content::WebContents* active_tab) { | 55 const content::WebContents* active_tab) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 void InstantOverlay::DidNavigate( | 70 void InstantOverlay::DidNavigate( |
| 70 const history::HistoryAddPageArgs& add_page_args) { | 71 const history::HistoryAddPageArgs& add_page_args) { |
| 71 last_navigation_ = add_page_args; | 72 last_navigation_ = add_page_args; |
| 72 } | 73 } |
| 73 | 74 |
| 74 void InstantOverlay::Update(const string16& text, | 75 void InstantOverlay::Update(const string16& text, |
| 75 size_t selection_start, | 76 size_t selection_start, |
| 76 size_t selection_end, | 77 size_t selection_end, |
| 77 bool verbatim) { | 78 bool verbatim) { |
| 78 last_navigation_ = history::HistoryAddPageArgs(); | 79 last_navigation_ = history::HistoryAddPageArgs(); |
| 79 InstantPage::Update(text, selection_start, selection_end, verbatim); | 80 sender()->Update(text, selection_start, selection_end, verbatim); |
| 80 } | 81 } |
| 81 | 82 |
| 82 bool InstantOverlay::ShouldProcessRenderViewCreated() { | 83 bool InstantOverlay::ShouldProcessRenderViewCreated() { |
| 83 return true; | 84 return true; |
| 84 } | 85 } |
| 85 | 86 |
| 86 bool InstantOverlay::ShouldProcessRenderViewGone() { | 87 bool InstantOverlay::ShouldProcessRenderViewGone() { |
| 87 return true; | 88 return true; |
| 88 } | 89 } |
| 89 | 90 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 163 } |
| 163 | 164 |
| 164 void InstantOverlay::LoadCompletedMainFrame() { | 165 void InstantOverlay::LoadCompletedMainFrame() { |
| 165 instant_controller()->OverlayLoadCompletedMainFrame(); | 166 instant_controller()->OverlayLoadCompletedMainFrame(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void InstantOverlay::HandleStalePage() { | 169 void InstantOverlay::HandleStalePage() { |
| 169 is_stale_ = true; | 170 is_stale_ = true; |
| 170 instant_controller()->ReloadOverlayIfStale(); | 171 instant_controller()->ReloadOverlayIfStale(); |
| 171 } | 172 } |
| OLD | NEW |