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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Number of ms to delay before updating the omnibox bounds. This is only used | 54 // Number of ms to delay before updating the omnibox bounds. This is only used |
55 // when the bounds of the omnibox shrinks. If the bounds grows, we update | 55 // when the bounds of the omnibox shrinks. If the bounds grows, we update |
56 // immediately. | 56 // immediately. |
57 const int kUpdateBoundsDelayMS = 1000; | 57 const int kUpdateBoundsDelayMS = 1000; |
58 | 58 |
59 // If this status code is seen instant is disabled for the specified host. | 59 // If this status code is seen instant is disabled for the specified host. |
60 const int kHostBlacklistStatusCode = 403; | 60 const int kHostBlacklistStatusCode = 403; |
61 | 61 |
62 // Header and value set for all loads. | 62 // Header and value set for all loads. |
63 const char kPreviewHeader[] = "X-Purpose"; | 63 const char kPreviewHeader[] = "X-Purpose"; |
64 const char kPreviewHeaderValue[] = "preview"; | 64 const char kPreviewHeaderValue[] = "instant"; |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 // FrameLoadObserver is responsible for determining if the page supports | 68 // FrameLoadObserver is responsible for determining if the page supports |
69 // instant after it has loaded. | 69 // instant after it has loaded. |
70 class InstantLoader::FrameLoadObserver : public NotificationObserver { | 70 class InstantLoader::FrameLoadObserver : public NotificationObserver { |
71 public: | 71 public: |
72 FrameLoadObserver(InstantLoader* loader, | 72 FrameLoadObserver(InstantLoader* loader, |
73 TabContents* tab_contents, | 73 TabContents* tab_contents, |
74 const string16& text, | 74 const string16& text, |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1040 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1041 if (cl->HasSwitch(switches::kInstantURL)) | 1041 if (cl->HasSwitch(switches::kInstantURL)) |
1042 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); | 1042 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); |
1043 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); | 1043 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); |
1044 RenderViewHost* host = preview_contents_->render_view_host(); | 1044 RenderViewHost* host = preview_contents_->render_view_host(); |
1045 host->Send(new ViewMsg_SearchBoxChange( | 1045 host->Send(new ViewMsg_SearchBoxChange( |
1046 host->routing_id(), user_text, verbatim, 0, 0)); | 1046 host->routing_id(), user_text, verbatim, 0, 0)); |
1047 frame_load_observer_.reset(new FrameLoadObserver( | 1047 frame_load_observer_.reset(new FrameLoadObserver( |
1048 this, preview_contents()->tab_contents(), user_text, verbatim)); | 1048 this, preview_contents()->tab_contents(), user_text, verbatim)); |
1049 } | 1049 } |
OLD | NEW |