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

Side by Side Diff: third_party/WebKit/Source/core/frame/Navigator.cpp

Issue 2716153003: Removed FrameHost::chromeClient() (Closed)
Patch Set: Small feedback Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details. 16 * Lesser General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Lesser General Public 18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software 19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * MA 02110-1301, USA 21 * MA 02110-1301, USA
22 */ 22 */
23 23
24 #include "core/frame/Navigator.h" 24 #include "core/frame/Navigator.h"
25 25
26 #include "bindings/core/v8/ScriptController.h" 26 #include "bindings/core/v8/ScriptController.h"
27 #include "core/dom/Document.h" 27 #include "core/dom/Document.h"
28 #include "core/frame/FrameHost.h"
29 #include "core/frame/LocalFrame.h" 28 #include "core/frame/LocalFrame.h"
30 #include "core/frame/NavigatorID.h" 29 #include "core/frame/NavigatorID.h"
31 #include "core/frame/Settings.h" 30 #include "core/frame/Settings.h"
32 #include "core/loader/CookieJar.h" 31 #include "core/loader/CookieJar.h"
33 #include "core/loader/FrameLoader.h" 32 #include "core/loader/FrameLoader.h"
34 #include "core/page/ChromeClient.h" 33 #include "core/page/ChromeClient.h"
34 #include "core/page/Page.h"
35 #include "platform/Language.h" 35 #include "platform/Language.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 Navigator::Navigator(LocalFrame* frame) : DOMWindowClient(frame) {} 39 Navigator::Navigator(LocalFrame* frame) : DOMWindowClient(frame) {}
40 40
41 String Navigator::productSub() const { 41 String Navigator::productSub() const {
42 return "20030107"; 42 return "20030107";
43 } 43 }
44 44
(...skipping 24 matching lines...) Expand all
69 Settings* settings = frame()->settings(); 69 Settings* settings = frame()->settings();
70 if (!settings || !settings->getCookieEnabled()) 70 if (!settings || !settings->getCookieEnabled())
71 return false; 71 return false;
72 72
73 return cookiesEnabled(frame()->document()); 73 return cookiesEnabled(frame()->document());
74 } 74 }
75 75
76 Vector<String> Navigator::languages() { 76 Vector<String> Navigator::languages() {
77 Vector<String> languages; 77 Vector<String> languages;
78 78
79 if (!frame() || !frame()->host()) { 79 if (!frame() || !frame()->page()) {
80 languages.push_back(defaultLanguage()); 80 languages.push_back(defaultLanguage());
81 return languages; 81 return languages;
82 } 82 }
83 83
84 String acceptLanguages = frame()->host()->chromeClient().acceptLanguages(); 84 String acceptLanguages = frame()->page()->chromeClient().acceptLanguages();
85 acceptLanguages.split(',', languages); 85 acceptLanguages.split(',', languages);
86 86
87 // Sanitizing tokens. We could do that more extensively but we should assume 87 // Sanitizing tokens. We could do that more extensively but we should assume
88 // that the accept languages are already sane and support BCP47. It is 88 // that the accept languages are already sane and support BCP47. It is
89 // likely a waste of time to make sure the tokens matches that spec here. 89 // likely a waste of time to make sure the tokens matches that spec here.
90 for (size_t i = 0; i < languages.size(); ++i) { 90 for (size_t i = 0; i < languages.size(); ++i) {
91 String& token = languages[i]; 91 String& token = languages[i];
92 token = token.stripWhiteSpace(); 92 token = token.stripWhiteSpace();
93 if (token.length() >= 3 && token[2] == '_') 93 if (token.length() >= 3 && token[2] == '_')
94 token.replace(2, 1, "-"); 94 token.replace(2, 1, "-");
95 } 95 }
96 96
97 return languages; 97 return languages;
98 } 98 }
99 99
100 DEFINE_TRACE(Navigator) { 100 DEFINE_TRACE(Navigator) {
101 DOMWindowClient::trace(visitor); 101 DOMWindowClient::trace(visitor);
102 Supplementable<Navigator>::trace(visitor); 102 Supplementable<Navigator>::trace(visitor);
103 } 103 }
104 104
105 } // namespace blink 105 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | third_party/WebKit/Source/core/frame/Screen.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698