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

Side by Side Diff: ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc

Issue 2645453003: Properly detect if Chrome is incognito (Closed)
Patch Set: Created 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.h" 5 #include "ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "components/grit/components_resources.h" 8 #include "components/grit/components_resources.h"
9 #include "components/ntp_tiles/field_trial.h" 9 #include "components/ntp_tiles/field_trial.h"
10 #include "components/ntp_tiles/most_visited_sites.h" 10 #include "components/ntp_tiles/most_visited_sites.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 DISALLOW_COPY_AND_ASSIGN(IOSNTPTilesInternalsMessageHandlerBridge); 51 DISALLOW_COPY_AND_ASSIGN(IOSNTPTilesInternalsMessageHandlerBridge);
52 }; 52 };
53 53
54 void IOSNTPTilesInternalsMessageHandlerBridge::RegisterMessages() { 54 void IOSNTPTilesInternalsMessageHandlerBridge::RegisterMessages() {
55 handler_.RegisterMessages(this); 55 handler_.RegisterMessages(this);
56 } 56 }
57 57
58 bool IOSNTPTilesInternalsMessageHandlerBridge::SupportsNTPTiles() { 58 bool IOSNTPTilesInternalsMessageHandlerBridge::SupportsNTPTiles() {
59 auto* state = ios::ChromeBrowserState::FromWebUIIOS(web_ui()); 59 auto* state = ios::ChromeBrowserState::FromWebUIIOS(web_ui());
60 return !state->HasOffTheRecordChromeBrowserState(); 60 return state == state->GetOriginalChromeBrowserState();
sdefresne 2017/01/19 12:14:07 Why not just use IsOffTheRecord() instead? auto
61 } 61 }
62 62
63 bool IOSNTPTilesInternalsMessageHandlerBridge::DoesSourceExist( 63 bool IOSNTPTilesInternalsMessageHandlerBridge::DoesSourceExist(
64 ntp_tiles::NTPTileSource source) { 64 ntp_tiles::NTPTileSource source) {
65 switch (source) { 65 switch (source) {
66 case ntp_tiles::NTPTileSource::TOP_SITES: 66 case ntp_tiles::NTPTileSource::TOP_SITES:
67 case ntp_tiles::NTPTileSource::SUGGESTIONS_SERVICE: 67 case ntp_tiles::NTPTileSource::SUGGESTIONS_SERVICE:
68 case ntp_tiles::NTPTileSource::POPULAR: 68 case ntp_tiles::NTPTileSource::POPULAR:
69 return true; 69 return true;
70 case ntp_tiles::NTPTileSource::WHITELIST: 70 case ntp_tiles::NTPTileSource::WHITELIST:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 NTPTilesInternalsUI::NTPTilesInternalsUI(web::WebUIIOS* web_ui) 118 NTPTilesInternalsUI::NTPTilesInternalsUI(web::WebUIIOS* web_ui)
119 : web::WebUIIOSController(web_ui) { 119 : web::WebUIIOSController(web_ui) {
120 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), 120 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
121 CreateNTPTilesInternalsHTMLSource()); 121 CreateNTPTilesInternalsHTMLSource());
122 web_ui->AddMessageHandler( 122 web_ui->AddMessageHandler(
123 base::MakeUnique<IOSNTPTilesInternalsMessageHandlerBridge>()); 123 base::MakeUnique<IOSNTPTilesInternalsMessageHandlerBridge>());
124 } 124 }
125 125
126 NTPTilesInternalsUI::~NTPTilesInternalsUI() {} 126 NTPTilesInternalsUI::~NTPTilesInternalsUI() {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698