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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( | 687 update_bounds_timer_.Start( |
688 base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS), | 688 base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS), |
689 this, &InstantLoader::ProcessBoundsChange); | 689 this, &InstantLoader::ProcessBoundsChange, FROM_HERE); |
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 } |
698 | 698 |
699 TabContentsWrapper* InstantLoader::ReleasePreviewContents( | 699 TabContentsWrapper* InstantLoader::ReleasePreviewContents( |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ChromeViewMsg_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 } |
OLD | NEW |