| OLD | NEW |
| 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 "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" | 5 #import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/ios/weak_nsobject.h" | 16 #include "base/ios/weak_nsobject.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/mac/bundle_locations.h" | 18 #include "base/mac/bundle_locations.h" |
| 19 #include "base/mac/foundation_util.h" | 19 #include "base/mac/foundation_util.h" |
| 20 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/metrics/user_metrics.h" | 21 #include "base/metrics/user_metrics.h" |
| 22 #include "base/metrics/user_metrics_action.h" | 22 #include "base/metrics/user_metrics_action.h" |
| 23 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
| 24 #include "components/google/core/browser/google_util.h" | 24 #include "components/google/core/browser/google_util.h" |
| 25 #include "components/omnibox/browser/omnibox_edit_model.h" | 25 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 26 #include "components/reading_list/core/reading_list_switches.h" | |
| 27 #include "components/search_engines/util.h" | 26 #include "components/search_engines/util.h" |
| 28 #include "components/strings/grit/components_strings.h" | 27 #include "components/strings/grit/components_strings.h" |
| 29 #include "components/toolbar/toolbar_model.h" | 28 #include "components/toolbar/toolbar_model.h" |
| 30 #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" | 29 #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" |
| 31 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 30 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 32 #include "ios/chrome/browser/chrome_url_constants.h" | 31 #include "ios/chrome/browser/chrome_url_constants.h" |
| 33 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 32 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 34 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 33 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 35 #import "ios/chrome/browser/tabs/tab.h" | 34 #import "ios/chrome/browser/tabs/tab.h" |
| 36 #import "ios/chrome/browser/tabs/tab_model.h" | 35 #import "ios/chrome/browser/tabs/tab_model.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 DCHECK(browserState); | 378 DCHECK(browserState); |
| 380 _delegate = delegate; | 379 _delegate = delegate; |
| 381 _urlLoader = urlLoader; | 380 _urlLoader = urlLoader; |
| 382 _browserState = browserState; | 381 _browserState = browserState; |
| 383 _incognito = browserState->IsOffTheRecord(); | 382 _incognito = browserState->IsOffTheRecord(); |
| 384 self = [super initWithStyle:(_incognito ? ToolbarControllerStyleIncognitoMode | 383 self = [super initWithStyle:(_incognito ? ToolbarControllerStyleIncognitoMode |
| 385 : ToolbarControllerStyleLightMode)]; | 384 : ToolbarControllerStyleLightMode)]; |
| 386 if (!self) | 385 if (!self) |
| 387 return nil; | 386 return nil; |
| 388 | 387 |
| 389 if (reading_list::switches::IsReadingListEnabled()) { | 388 self.readingListModel = |
| 390 self.readingListModel = | 389 ReadingListModelFactory::GetForBrowserState(browserState); |
| 391 ReadingListModelFactory::GetForBrowserState(browserState); | |
| 392 } | |
| 393 | 390 |
| 394 InterfaceIdiom idiom = IsIPadIdiom() ? IPAD_IDIOM : IPHONE_IDIOM; | 391 InterfaceIdiom idiom = IsIPadIdiom() ? IPAD_IDIOM : IPHONE_IDIOM; |
| 395 // Note that |_webToolbar| gets its frame set to -specificControlArea later in | 392 // Note that |_webToolbar| gets its frame set to -specificControlArea later in |
| 396 // this method. | 393 // this method. |
| 397 _webToolbar.reset([[UIView alloc] | 394 _webToolbar.reset([[UIView alloc] |
| 398 initWithFrame:LayoutRectGetRect(kWebToolbarFrame[idiom])]); | 395 initWithFrame:LayoutRectGetRect(kWebToolbarFrame[idiom])]); |
| 399 UIColor* textColor = | 396 UIColor* textColor = |
| 400 _incognito | 397 _incognito |
| 401 ? [UIColor whiteColor] | 398 ? [UIColor whiteColor] |
| 402 : [UIColor colorWithWhite:0 alpha:[MDCTypography body1FontOpacity]]; | 399 : [UIColor colorWithWhite:0 alpha:[MDCTypography body1FontOpacity]]; |
| (...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 | 2569 |
| 2573 - (BOOL)isPrerenderAnimationRunning { | 2570 - (BOOL)isPrerenderAnimationRunning { |
| 2574 return _prerenderAnimating; | 2571 return _prerenderAnimating; |
| 2575 } | 2572 } |
| 2576 | 2573 |
| 2577 - (OmniboxTextFieldIOS*)omnibox { | 2574 - (OmniboxTextFieldIOS*)omnibox { |
| 2578 return _omniBox.get(); | 2575 return _omniBox.get(); |
| 2579 } | 2576 } |
| 2580 | 2577 |
| 2581 @end | 2578 @end |
| OLD | NEW |