OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/alternate_nav_url_fetcher.h" | 14 #include "chrome/browser/alternate_nav_url_fetcher.h" |
15 #import "chrome/browser/app_controller_mac.h" | 15 #import "chrome/browser/app_controller_mac.h" |
16 #include "chrome/browser/chrome_to_mobile_service.h" | 16 #include "chrome/browser/chrome_to_mobile_service.h" |
17 #include "chrome/browser/chrome_to_mobile_service_factory.h" | 17 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
18 #include "chrome/browser/command_updater.h" | 18 #include "chrome/browser/command_updater.h" |
19 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
20 #include "chrome/browser/extensions/api/tabs/tabs.h" | 20 #include "chrome/browser/extensions/api/tabs/tabs.h" |
21 #include "chrome/browser/extensions/extension_browser_event_router.h" | 21 #include "chrome/browser/extensions/extension_browser_event_router.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/extensions/extension_tab_helper.h" | 23 #include "chrome/browser/extensions/extension_tab_helper.h" |
24 #include "chrome/browser/extensions/location_bar_controller.h" | 24 #include "chrome/browser/extensions/location_bar_controller.h" |
25 #include "chrome/browser/instant/instant_controller.h" | 25 #include "chrome/browser/instant/instant_controller.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/search_engines/template_url.h" | 27 #include "chrome/browser/search_engines/template_url.h" |
28 #include "chrome/browser/search_engines/template_url_service.h" | 28 #include "chrome/browser/search_engines/template_url_service.h" |
29 #include "chrome/browser/search_engines/template_url_service_factory.h" | 29 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 30 #include "chrome/browser/ui/browser_instant_controller.h" |
30 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
31 #include "chrome/browser/ui/browser_tabstrip.h" | 32 #include "chrome/browser/ui/browser_tabstrip.h" |
32 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 33 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
33 #include "chrome/browser/ui/cocoa/event_utils.h" | 34 #include "chrome/browser/ui/cocoa/event_utils.h" |
34 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" | 35 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" |
35 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 36 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
36 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" | 37 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
37 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 38 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
38 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 39 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
39 #import "chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h" | 40 #import "chrome/browser/ui/cocoa/location_bar/chrome_to_mobile_decoration.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 313 |
313 SkBitmap LocationBarViewMac::GetFavicon() const { | 314 SkBitmap LocationBarViewMac::GetFavicon() const { |
314 return browser_->GetCurrentPageIcon(); | 315 return browser_->GetCurrentPageIcon(); |
315 } | 316 } |
316 | 317 |
317 string16 LocationBarViewMac::GetTitle() const { | 318 string16 LocationBarViewMac::GetTitle() const { |
318 return browser_->GetWindowTitleForCurrentTab(); | 319 return browser_->GetWindowTitleForCurrentTab(); |
319 } | 320 } |
320 | 321 |
321 InstantController* LocationBarViewMac::GetInstant() { | 322 InstantController* LocationBarViewMac::GetInstant() { |
322 return browser_->instant(); | 323 return browser_->instant_controller()->instant(); |
323 } | 324 } |
324 | 325 |
325 TabContents* LocationBarViewMac::GetTabContents() const { | 326 TabContents* LocationBarViewMac::GetTabContents() const { |
326 return chrome::GetActiveTabContents(browser_); | 327 return chrome::GetActiveTabContents(browser_); |
327 } | 328 } |
328 | 329 |
329 void LocationBarViewMac::Revert() { | 330 void LocationBarViewMac::Revert() { |
330 omnibox_view_->RevertAll(); | 331 omnibox_view_->RevertAll(); |
331 } | 332 } |
332 | 333 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 void LocationBarViewMac::UpdateChromeToMobileEnabled() { | 719 void LocationBarViewMac::UpdateChromeToMobileEnabled() { |
719 if (!chrome_to_mobile_decoration_.get()) | 720 if (!chrome_to_mobile_decoration_.get()) |
720 return; | 721 return; |
721 | 722 |
722 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); | 723 DCHECK(ChromeToMobileService::IsChromeToMobileEnabled()); |
723 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && | 724 bool enabled = [field_ isEditable] && !toolbar_model_->input_in_progress() && |
724 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); | 725 ChromeToMobileServiceFactory::GetForProfile(profile_)->HasDevices(); |
725 chrome_to_mobile_decoration_->SetVisible(enabled); | 726 chrome_to_mobile_decoration_->SetVisible(enabled); |
726 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); | 727 command_updater_->UpdateCommandEnabled(IDC_CHROME_TO_MOBILE_PAGE, enabled); |
727 } | 728 } |
OLD | NEW |