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 25 matching lines...) Expand all Loading... |
36 #include "content/browser/tab_contents/navigation_details.h" | 36 #include "content/browser/tab_contents/navigation_details.h" |
37 #include "content/browser/tab_contents/navigation_entry.h" | 37 #include "content/browser/tab_contents/navigation_entry.h" |
38 #include "content/browser/tab_contents/provisional_load_details.h" | 38 #include "content/browser/tab_contents/provisional_load_details.h" |
39 #include "content/browser/tab_contents/tab_contents.h" | 39 #include "content/browser/tab_contents/tab_contents.h" |
40 #include "content/browser/tab_contents/tab_contents_delegate.h" | 40 #include "content/browser/tab_contents/tab_contents_delegate.h" |
41 #include "content/browser/tab_contents/tab_contents_view.h" | 41 #include "content/browser/tab_contents/tab_contents_view.h" |
42 #include "content/common/renderer_preferences.h" | 42 #include "content/common/renderer_preferences.h" |
43 #include "content/public/browser/notification_details.h" | 43 #include "content/public/browser/notification_details.h" |
44 #include "content/public/browser/notification_observer.h" | 44 #include "content/public/browser/notification_observer.h" |
45 #include "content/public/browser/notification_registrar.h" | 45 #include "content/public/browser/notification_registrar.h" |
46 #include "content/common/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
47 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
48 #include "content/public/browser/notification_types.h" | 48 #include "content/public/browser/notification_types.h" |
49 #include "net/http/http_util.h" | 49 #include "net/http/http_util.h" |
50 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
51 #include "ui/gfx/codec/png_codec.h" | 51 #include "ui/gfx/codec/png_codec.h" |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // Number of ms to delay before updating the omnibox bounds. This is only used | 55 // Number of ms to delay before updating the omnibox bounds. This is only used |
56 // when the bounds of the omnibox shrinks. If the bounds grows, we update | 56 // when the bounds of the omnibox shrinks. If the bounds grows, we update |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 559 |
560 void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined( | 560 void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined( |
561 int32 page_id, | 561 int32 page_id, |
562 bool result) { | 562 bool result) { |
563 TabContents* source = loader_->preview_contents()->tab_contents(); | 563 TabContents* source = loader_->preview_contents()->tab_contents(); |
564 if (!source->controller().GetActiveEntry() || | 564 if (!source->controller().GetActiveEntry() || |
565 page_id != source->controller().GetActiveEntry()->page_id()) | 565 page_id != source->controller().GetActiveEntry()->page_id()) |
566 return; | 566 return; |
567 | 567 |
568 content::Details<const bool> details(&result); | 568 content::Details<const bool> details(&result); |
569 NotificationService::current()->Notify( | 569 content::NotificationService::current()->Notify( |
570 chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, | 570 chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, |
571 NotificationService::AllSources(), | 571 content::NotificationService::AllSources(), |
572 details); | 572 details); |
573 | 573 |
574 if (result) | 574 if (result) |
575 loader_->PageFinishedLoading(); | 575 loader_->PageFinishedLoading(); |
576 else | 576 else |
577 loader_->PageDoesntSupportInstant(user_typed_before_load_); | 577 loader_->PageDoesntSupportInstant(user_typed_before_load_); |
578 | 578 |
579 AddPreviewUsageForHistogram(loader_->template_url_id(), PREVIEW_LOADED); | 579 AddPreviewUsageForHistogram(loader_->template_url_id(), PREVIEW_LOADED); |
580 } | 580 } |
581 | 581 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 host->Send(new ChromeViewMsg_SearchBoxResize( | 1087 host->Send(new ChromeViewMsg_SearchBoxResize( |
1088 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); | 1088 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); |
1089 } else { | 1089 } else { |
1090 host->Send(new ChromeViewMsg_SearchBoxChange( | 1090 host->Send(new ChromeViewMsg_SearchBoxChange( |
1091 host->routing_id(), user_text, verbatim, 0, 0)); | 1091 host->routing_id(), user_text, verbatim, 0, 0)); |
1092 } | 1092 } |
1093 | 1093 |
1094 frame_load_observer_.reset(new FrameLoadObserver( | 1094 frame_load_observer_.reset(new FrameLoadObserver( |
1095 this, preview_contents()->tab_contents(), user_text, verbatim)); | 1095 this, preview_contents()->tab_contents(), user_text, verbatim)); |
1096 } | 1096 } |
OLD | NEW |