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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 1578193002: Remove ChromeToolbarModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DEPS file Created 4 years, 11 months 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 | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm » ('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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" 43 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h"
44 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" 44 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h"
45 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h" 45 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h"
46 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" 46 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h"
47 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 47 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
48 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 48 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
49 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 49 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 50 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 51 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
52 #include "chrome/browser/ui/tabs/tab_strip_model.h" 52 #include "chrome/browser/ui/tabs/tab_strip_model.h"
53 #include "chrome/browser/ui/toolbar/chrome_toolbar_model.h"
54 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/pref_names.h" 54 #include "chrome/common/pref_names.h"
56 #include "components/bookmarks/common/bookmark_pref_names.h" 55 #include "components/bookmarks/common/bookmark_pref_names.h"
57 #import "components/omnibox/browser/omnibox_popup_model.h" 56 #import "components/omnibox/browser/omnibox_popup_model.h"
58 #include "components/search_engines/template_url.h" 57 #include "components/search_engines/template_url.h"
59 #include "components/search_engines/template_url_service.h" 58 #include "components/search_engines/template_url_service.h"
60 #include "components/translate/core/browser/language_state.h" 59 #include "components/translate/core/browser/language_state.h"
61 #include "components/ui/zoom/zoom_controller.h" 60 #include "components/ui/zoom/zoom_controller.h"
62 #include "components/ui/zoom/zoom_event_manager.h" 61 #include "components/ui/zoom/zoom_event_manager.h"
63 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // Get the keyword to use for keyword-search and hinting. 433 // Get the keyword to use for keyword-search and hinting.
435 const base::string16 keyword = omnibox_view_->model()->keyword(); 434 const base::string16 keyword = omnibox_view_->model()->keyword();
436 base::string16 short_name; 435 base::string16 short_name;
437 bool is_extension_keyword = false; 436 bool is_extension_keyword = false;
438 if (!keyword.empty()) { 437 if (!keyword.empty()) {
439 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> 438 short_name = TemplateURLServiceFactory::GetForProfile(profile())->
440 GetKeywordShortName(keyword, &is_extension_keyword); 439 GetKeywordShortName(keyword, &is_extension_keyword);
441 } 440 }
442 441
443 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); 442 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint();
444 ChromeToolbarModel* chrome_toolbar_model =
445 static_cast<ChromeToolbarModel*>(GetToolbarModel());
446 if (!keyword.empty() && !is_keyword_hint) { 443 if (!keyword.empty() && !is_keyword_hint) {
447 // Switch from location icon to keyword mode. 444 // Switch from location icon to keyword mode.
448 location_icon_decoration_->SetVisible(false); 445 location_icon_decoration_->SetVisible(false);
449 selected_keyword_decoration_->SetVisible(true); 446 selected_keyword_decoration_->SetVisible(true);
450 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); 447 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword);
451 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); 448 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword));
452 } else if (chrome_toolbar_model->GetSecurityLevel(false) == 449 } else if (GetToolbarModel()->GetSecurityLevel(false) ==
453 security_state::SecurityStateModel::EV_SECURE) { 450 security_state::SecurityStateModel::EV_SECURE) {
454 // Switch from location icon to show the EV bubble instead. 451 // Switch from location icon to show the EV bubble instead.
455 location_icon_decoration_->SetVisible(false); 452 location_icon_decoration_->SetVisible(false);
456 ev_bubble_decoration_->SetVisible(true); 453 ev_bubble_decoration_->SetVisible(true);
457 454
458 base::string16 label(GetToolbarModel()->GetEVCertName()); 455 base::string16 label(GetToolbarModel()->GetEVCertName());
459 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); 456 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label));
460 } else if (!keyword.empty() && is_keyword_hint) { 457 } else if (!keyword.empty() && is_keyword_hint) {
461 keyword_hint_decoration_->SetKeyword(short_name, 458 keyword_hint_decoration_->SetKeyword(short_name,
462 is_extension_keyword); 459 is_extension_keyword);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 717
721 return zoom_decoration_->UpdateIfNecessary( 718 return zoom_decoration_->UpdateIfNecessary(
722 ui_zoom::ZoomController::FromWebContents(web_contents), 719 ui_zoom::ZoomController::FromWebContents(web_contents),
723 default_zoom_changed); 720 default_zoom_changed);
724 } 721 }
725 722
726 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 723 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
727 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 724 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
728 OnDecorationsChanged(); 725 OnDecorationsChanged();
729 } 726 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698