| 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/instant/instant_overlay.h" | 5 #include "chrome/browser/instant/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/ui/search/search.h" |
| 9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 10 | 11 |
| 11 namespace { | 12 namespace { |
| 12 | 13 |
| 13 int kUserDataKey; | 14 int kUserDataKey; |
| 14 | 15 |
| 15 class InstantOverlayUserData : public base::SupportsUserData::Data { | 16 class InstantOverlayUserData : public base::SupportsUserData::Data { |
| 16 public: | 17 public: |
| 17 explicit InstantOverlayUserData(InstantOverlay* overlay) | 18 explicit InstantOverlayUserData(InstantOverlay* overlay) |
| 18 : overlay_(overlay) {} | 19 : overlay_(overlay) {} |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 SetContents(NULL); | 65 SetContents(NULL); |
| 65 return loader_.ReleaseContents(); | 66 return loader_.ReleaseContents(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void InstantOverlay::DidNavigate( | 69 void InstantOverlay::DidNavigate( |
| 69 const history::HistoryAddPageArgs& add_page_args) { | 70 const history::HistoryAddPageArgs& add_page_args) { |
| 70 last_navigation_ = add_page_args; | 71 last_navigation_ = add_page_args; |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool InstantOverlay::IsUsingLocalPreview() const { | 74 bool InstantOverlay::IsUsingLocalPreview() const { |
| 74 return instant_url_ == InstantController::kLocalOmniboxPopupURL; | 75 return instant_url_ == chrome::search::kLocalOmniboxPopupURL; |
| 75 } | 76 } |
| 76 | 77 |
| 77 void InstantOverlay::Update(const string16& text, | 78 void InstantOverlay::Update(const string16& text, |
| 78 size_t selection_start, | 79 size_t selection_start, |
| 79 size_t selection_end, | 80 size_t selection_end, |
| 80 bool verbatim) { | 81 bool verbatim) { |
| 81 last_navigation_ = history::HistoryAddPageArgs(); | 82 last_navigation_ = history::HistoryAddPageArgs(); |
| 82 InstantPage::Update(text, selection_start, selection_end, verbatim); | 83 InstantPage::Update(text, selection_start, selection_end, verbatim); |
| 83 } | 84 } |
| 84 | 85 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 DCHECK_NE(&loader_, overlay->GetDelegate()); | 146 DCHECK_NE(&loader_, overlay->GetDelegate()); |
| 146 return overlay->GetDelegate()->OpenURLFromTab(source, params); | 147 return overlay->GetDelegate()->OpenURLFromTab(source, params); |
| 147 } | 148 } |
| 148 return NULL; | 149 return NULL; |
| 149 } | 150 } |
| 150 | 151 |
| 151 void InstantOverlay::HandleStalePage() { | 152 void InstantOverlay::HandleStalePage() { |
| 152 is_stale_ = true; | 153 is_stale_ = true; |
| 153 instant_controller()->ReloadOverlayIfStale(); | 154 instant_controller()->ReloadOverlayIfStale(); |
| 154 } | 155 } |
| OLD | NEW |