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

Side by Side Diff: chrome/browser/ui/views/toolbar/site_chip_view.cc

Issue 110893004: [SiteChip] Add UMA, finish wiring site chip experiment up to the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/toolbar/site_chip_view.h" 5 #include "chrome/browser/ui/views/toolbar/site_chip_view.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/metrics/histogram.h"
8 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/extensions/extension_icon_image.h" 13 #include "chrome/browser/extensions/extension_icon_image.h"
13 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_system.h" 15 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 16 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/safe_browsing/client_side_detection_host.h" 18 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
18 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" 20 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h"
20 #include "chrome/browser/safe_browsing/ui_manager.h" 21 #include "chrome/browser/safe_browsing/ui_manager.h"
21 #include "chrome/browser/search/search.h" 22 #include "chrome/browser/search/search.h"
22 #include "chrome/browser/themes/theme_properties.h" 23 #include "chrome/browser/themes/theme_properties.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/omnibox/omnibox_view.h" 25 #include "chrome/browser/ui/omnibox/omnibox_view.h"
25 #include "chrome/browser/ui/toolbar/toolbar_model.h" 26 #include "chrome/browser/ui/toolbar/toolbar_model.h"
26 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 27 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
27 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 28 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
28 #include "chrome/common/extensions/extension_constants.h" 29 #include "chrome/common/extensions/extension_constants.h"
29 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" 30 #include "chrome/common/extensions/manifest_handlers/icons_handler.h"
30 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
31 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
33 #include "content/public/browser/user_metrics.h"
32 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
33 #include "content/public/common/url_constants.h" 35 #include "content/public/common/url_constants.h"
34 #include "extensions/common/constants.h" 36 #include "extensions/common/constants.h"
35 #include "grit/component_strings.h" 37 #include "grit/component_strings.h"
36 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
37 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
38 #include "net/base/net_util.h" 40 #include "net/base/net_util.h"
39 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
40 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
41 #include "ui/base/theme_provider.h" 43 #include "ui/base/theme_provider.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 if (painter_) 435 if (painter_)
434 views::Painter::PaintPainterAt(canvas, painter_, rect); 436 views::Painter::PaintPainterAt(canvas, painter_, rect);
435 437
436 ToolbarButton::OnPaint(canvas); 438 ToolbarButton::OnPaint(canvas);
437 } 439 }
438 440
439 // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for 441 // TODO(gbillock): Make the LocationBarView or OmniboxView the listener for
440 // this button. 442 // this button.
441 void SiteChipView::ButtonPressed(views::Button* sender, 443 void SiteChipView::ButtonPressed(views::Button* sender,
442 const ui::Event& event) { 444 const ui::Event& event) {
445 UMA_HISTOGRAM_COUNTS("SiteChip.Pressed", 1);
msw 2013/12/12 00:17:49 What are you trying to record? This will do a dece
Greg Billock 2013/12/12 20:36:37 Yeah, I'll add the histograms.xml descriptor separ
446 content::RecordAction(content::UserMetricsAction("SiteChipPress"));
443 toolbar_view_->location_bar()->GetOmniboxView()->SetFocus(); 447 toolbar_view_->location_bar()->GetOmniboxView()->SetFocus();
msw 2013/12/12 00:17:49 nit: make a local OmniboxView* omnibox_view = tool
Greg Billock 2013/12/12 20:36:37 After Justin's change, we won't need SetFocus, and
444 toolbar_view_->location_bar()->GetOmniboxView()->SelectAll(true);
445 toolbar_view_->location_bar()->GetOmniboxView()->model()-> 448 toolbar_view_->location_bar()->GetOmniboxView()->model()->
446 SetCaretVisibility(true); 449 SetCaretVisibility(true);
450 toolbar_view_->location_bar()->GetOmniboxView()->ShowURL();
451 //toolbar_view_->location_bar()->GetOmniboxView()->SelectAll(true);
msw 2013/12/12 00:17:49 Remove this.
Greg Billock 2013/12/12 20:36:37 Done.
447 } 452 }
448 453
449 void SiteChipView::WriteDragDataForView(View* sender, 454 void SiteChipView::WriteDragDataForView(View* sender,
450 const gfx::Point& press_pt, 455 const gfx::Point& press_pt,
451 OSExchangeData* data) { 456 OSExchangeData* data) {
452 // TODO(gbillock): Consolidate this with the identical logic in 457 // TODO(gbillock): Consolidate this with the identical logic in
453 // LocationBarView. 458 // LocationBarView.
454 content::WebContents* web_contents = toolbar_view_->GetWebContents(); 459 content::WebContents* web_contents = toolbar_view_->GetWebContents();
455 FaviconTabHelper* favicon_tab_helper = 460 FaviconTabHelper* favicon_tab_helper =
456 FaviconTabHelper::FromWebContents(web_contents); 461 FaviconTabHelper::FromWebContents(web_contents);
(...skipping 19 matching lines...) Expand all
476 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will 481 // Note: When OnSafeBrowsingHit would be called, OnSafeBrowsingMatch will
477 // have already been called. 482 // have already been called.
478 void SiteChipView::OnSafeBrowsingHit( 483 void SiteChipView::OnSafeBrowsingHit(
479 const SafeBrowsingUIManager::UnsafeResource& resource) {} 484 const SafeBrowsingUIManager::UnsafeResource& resource) {}
480 485
481 void SiteChipView::OnSafeBrowsingMatch( 486 void SiteChipView::OnSafeBrowsingMatch(
482 const SafeBrowsingUIManager::UnsafeResource& resource) { 487 const SafeBrowsingUIManager::UnsafeResource& resource) {
483 OnChanged(); 488 OnChanged();
484 } 489 }
485 490
OLDNEW
« chrome/browser/ui/omnibox/omnibox_view.h ('K') | « chrome/browser/ui/omnibox/omnibox_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698