| OLD | NEW |
| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 if (preview_contents_.get() && is_showing_instant() && | 677 if (preview_contents_.get() && is_showing_instant() && |
| 678 !is_waiting_for_load()) { | 678 !is_waiting_for_load()) { |
| 679 // Updating the bounds is rather expensive, and because of the async nature | 679 // Updating the bounds is rather expensive, and because of the async nature |
| 680 // of the omnibox the bounds can dance around a bit. Delay the update in | 680 // of the omnibox the bounds can dance around a bit. Delay the update in |
| 681 // hopes of things settling down. To avoid hiding results we grow | 681 // hopes of things settling down. To avoid hiding results we grow |
| 682 // immediately, but delay shrinking. | 682 // immediately, but delay shrinking. |
| 683 update_bounds_timer_.Stop(); | 683 update_bounds_timer_.Stop(); |
| 684 if (omnibox_bounds_.height() > last_omnibox_bounds_.height()) { | 684 if (omnibox_bounds_.height() > last_omnibox_bounds_.height()) { |
| 685 SendBoundsToPage(false); | 685 SendBoundsToPage(false); |
| 686 } else { | 686 } else { |
| 687 update_bounds_timer_.Start(FROM_HERE, | 687 update_bounds_timer_.Start( |
| 688 base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS), | 688 base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS), |
| 689 this, &InstantLoader::ProcessBoundsChange); | 689 this, &InstantLoader::ProcessBoundsChange); |
| 690 } | 690 } |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 | 693 |
| 694 bool InstantLoader::IsMouseDownFromActivate() { | 694 bool InstantLoader::IsMouseDownFromActivate() { |
| 695 return preview_tab_contents_delegate_.get() && | 695 return preview_tab_contents_delegate_.get() && |
| 696 preview_tab_contents_delegate_->is_mouse_down_from_activate(); | 696 preview_tab_contents_delegate_->is_mouse_down_from_activate(); |
| 697 } | 697 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1033 CommandLine* cl = CommandLine::ForCurrentProcess(); |
| 1034 if (cl->HasSwitch(switches::kInstantURL)) | 1034 if (cl->HasSwitch(switches::kInstantURL)) |
| 1035 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); | 1035 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); |
| 1036 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); | 1036 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); |
| 1037 RenderViewHost* host = preview_contents_->render_view_host(); | 1037 RenderViewHost* host = preview_contents_->render_view_host(); |
| 1038 host->Send(new ChromeViewMsg_SearchBoxChange( | 1038 host->Send(new ChromeViewMsg_SearchBoxChange( |
| 1039 host->routing_id(), user_text, verbatim, 0, 0)); | 1039 host->routing_id(), user_text, verbatim, 0, 0)); |
| 1040 frame_load_observer_.reset(new FrameLoadObserver( | 1040 frame_load_observer_.reset(new FrameLoadObserver( |
| 1041 this, preview_contents()->tab_contents(), user_text, verbatim)); | 1041 this, preview_contents()->tab_contents(), user_text, verbatim)); |
| 1042 } | 1042 } |
| OLD | NEW |