Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Side by Side Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 2544883006: Cleanup: Replace NTPLoggingTileSource by ntp_tiles::NTPTileSource (Closed)
Patch Set: tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | components/ntp_tiles/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/renderer/searchbox/searchbox_extension.h" 5 #include "chrome/renderer/searchbox/searchbox_extension.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/json/string_escape.h" 12 #include "base/json/string_escape.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "chrome/common/search/instant_types.h" 19 #include "chrome/common/search/instant_types.h"
20 #include "chrome/common/search/ntp_logging_events.h" 20 #include "chrome/common/search/ntp_logging_events.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "chrome/grit/renderer_resources.h" 22 #include "chrome/grit/renderer_resources.h"
23 #include "chrome/renderer/searchbox/searchbox.h" 23 #include "chrome/renderer/searchbox/searchbox.h"
24 #include "components/crx_file/id_util.h" 24 #include "components/crx_file/id_util.h"
25 #include "components/ntp_tiles/ntp_tile_source.h"
25 #include "content/public/renderer/render_view.h" 26 #include "content/public/renderer/render_view.h"
26 #include "third_party/WebKit/public/platform/WebURLRequest.h" 27 #include "third_party/WebKit/public/platform/WebURLRequest.h"
27 #include "third_party/WebKit/public/web/WebDocument.h" 28 #include "third_party/WebKit/public/web/WebDocument.h"
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" 29 #include "third_party/WebKit/public/web/WebLocalFrame.h"
29 #include "third_party/WebKit/public/web/WebScriptSource.h" 30 #include "third_party/WebKit/public/web/WebScriptSource.h"
30 #include "third_party/WebKit/public/web/WebView.h" 31 #include "third_party/WebKit/public/web/WebView.h"
31 #include "ui/base/resource/resource_bundle.h" 32 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/base/ui_base_switches.h" 33 #include "ui/base/ui_base_switches.h"
33 #include "ui/base/window_open_disposition.h" 34 #include "ui/base/window_open_disposition.h"
34 #include "ui/events/keycodes/keyboard_codes.h" 35 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 GURL(chrome::kChromeSearchMostVisitedUrl)); 1013 GURL(chrome::kChromeSearchMostVisitedUrl));
1013 if (!render_view) return; 1014 if (!render_view) return;
1014 1015
1015 if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) { 1016 if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
1016 ThrowInvalidParameters(args); 1017 ThrowInvalidParameters(args);
1017 return; 1018 return;
1018 } 1019 }
1019 1020
1020 DVLOG(1) << render_view << " LogMostVisitedImpression"; 1021 DVLOG(1) << render_view << " LogMostVisitedImpression";
1021 1022
1022 if (args[1]->Uint32Value() <= static_cast<int>(NTPLoggingTileSource::LAST)) { 1023 if (args[1]->Uint32Value() <=
1023 NTPLoggingTileSource tile_source = 1024 static_cast<int>(ntp_tiles::NTPTileSource::LAST)) {
1024 static_cast<NTPLoggingTileSource>(args[1]->Uint32Value()); 1025 ntp_tiles::NTPTileSource tile_source =
1026 static_cast<ntp_tiles::NTPTileSource>(args[1]->Uint32Value());
1025 SearchBox::Get(render_view)->LogMostVisitedImpression( 1027 SearchBox::Get(render_view)->LogMostVisitedImpression(
1026 args[0]->IntegerValue(), tile_source); 1028 args[0]->IntegerValue(), tile_source);
1027 } 1029 }
1028 } 1030 }
1029 1031
1030 // static 1032 // static
1031 void SearchBoxExtensionWrapper::LogMostVisitedNavigation( 1033 void SearchBoxExtensionWrapper::LogMostVisitedNavigation(
1032 const v8::FunctionCallbackInfo<v8::Value>& args) { 1034 const v8::FunctionCallbackInfo<v8::Value>& args) {
1033 content::RenderView* render_view = GetRenderViewWithCheckedOrigin( 1035 content::RenderView* render_view = GetRenderViewWithCheckedOrigin(
1034 GURL(chrome::kChromeSearchMostVisitedUrl)); 1036 GURL(chrome::kChromeSearchMostVisitedUrl));
1035 if (!render_view) return; 1037 if (!render_view) return;
1036 1038
1037 if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) { 1039 if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
1038 ThrowInvalidParameters(args); 1040 ThrowInvalidParameters(args);
1039 return; 1041 return;
1040 } 1042 }
1041 1043
1042 DVLOG(1) << render_view << " LogMostVisitedNavigation"; 1044 DVLOG(1) << render_view << " LogMostVisitedNavigation";
1043 1045
1044 if (args[1]->Uint32Value() <= static_cast<int>(NTPLoggingTileSource::LAST)) { 1046 if (args[1]->Uint32Value() <=
1045 NTPLoggingTileSource tile_source = 1047 static_cast<int>(ntp_tiles::NTPTileSource::LAST)) {
1046 static_cast<NTPLoggingTileSource>(args[1]->Uint32Value()); 1048 ntp_tiles::NTPTileSource tile_source =
1049 static_cast<ntp_tiles::NTPTileSource>(args[1]->Uint32Value());
1047 SearchBox::Get(render_view)->LogMostVisitedNavigation( 1050 SearchBox::Get(render_view)->LogMostVisitedNavigation(
1048 args[0]->IntegerValue(), tile_source); 1051 args[0]->IntegerValue(), tile_source);
1049 } 1052 }
1050 } 1053 }
1051 1054
1052 // static 1055 // static
1053 void SearchBoxExtensionWrapper::Paste( 1056 void SearchBoxExtensionWrapper::Paste(
1054 const v8::FunctionCallbackInfo<v8::Value>& args) { 1057 const v8::FunctionCallbackInfo<v8::Value>& args) {
1055 content::RenderView* render_view = GetRenderView(); 1058 content::RenderView* render_view = GetRenderView();
1056 if (!render_view) return; 1059 if (!render_view) return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 ThrowInvalidParameters(args); 1107 ThrowInvalidParameters(args);
1105 return; 1108 return;
1106 } 1109 }
1107 1110
1108 DVLOG(1) << render_view << " UndoMostVisitedDeletion"; 1111 DVLOG(1) << render_view << " UndoMostVisitedDeletion";
1109 SearchBox::Get(render_view) 1112 SearchBox::Get(render_view)
1110 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); 1113 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value());
1111 } 1114 }
1112 1115
1113 } // namespace extensions_v8 1116 } // namespace extensions_v8
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | components/ntp_tiles/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698