| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.
h" | |
| 6 | |
| 7 #include "base/files/file_path.h" | |
| 8 #include "ios/public/provider/web/web_ui_ios.h" | |
| 9 #include "ios/web/public/web_state/web_state.h" | |
| 10 | |
| 11 namespace ios { | |
| 12 | |
| 13 // static | |
| 14 ChromeBrowserState* ChromeBrowserState::FromBrowserState( | |
| 15 web::BrowserState* browser_state) { | |
| 16 // This is safe; this is the only implementation of BrowserState. | |
| 17 return static_cast<ChromeBrowserState*>(browser_state); | |
| 18 } | |
| 19 | |
| 20 // static | |
| 21 ChromeBrowserState* ChromeBrowserState::FromWebUIIOS(web::WebUIIOS* web_ui) { | |
| 22 return FromBrowserState(web_ui->GetWebState()->GetBrowserState()); | |
| 23 } | |
| 24 | |
| 25 std::string ChromeBrowserState::GetDebugName() { | |
| 26 // The debug name is based on the state path of the original browser state | |
| 27 // to keep in sync with the meaning on other platforms. | |
| 28 std::string name = | |
| 29 GetOriginalChromeBrowserState()->GetStatePath().BaseName().MaybeAsASCII(); | |
| 30 if (name.empty()) { | |
| 31 name = "UnknownBrowserState"; | |
| 32 } | |
| 33 return name; | |
| 34 } | |
| 35 | |
| 36 } // namespace ios | |
| OLD | NEW |