本文整理汇总了C++中Window::GetPrivacyMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::GetPrivacyMode方法的具体用法?C++ Window::GetPrivacyMode怎么用?C++ Window::GetPrivacyMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window::GetPrivacyMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTabInfo
/* virtual */ ES_GetState
DOM_BrowserTab::GetName(OpAtom property_name, ES_Value* value, ES_Runtime* origining_runtime)
{
switch (property_name)
{
case OP_ATOM_id:
DOMSetNumber(value, GetTabId());
return GET_SUCCESS;
case OP_ATOM_locked:
case OP_ATOM_browserWindow:
case OP_ATOM_position:
case OP_ATOM_tabGroup:
case OP_ATOM_focused:
case OP_ATOM_selected:
case OP_ATOM_title:
case OP_ATOM_private:
case OP_ATOM_closed:
return GetTabInfo(property_name, value, origining_runtime, NULL);
case OP_ATOM_faviconUrl:
{
#ifdef SHORTCUT_ICON_SUPPORT
Window* window = GetTabWindow();
if (window && (!window->GetPrivacyMode() || IsPrivateDataAllowed()))
DOMSetString(value, window->GetWindowIconURL().GetAttribute(URL::KUniName_With_Fragment, URL::KNoRedirect).CStr());
#endif // SHORTCUT_ICON_SUPPORT
return GET_SUCCESS;
}
case OP_ATOM_url:
{
Window* window = GetTabWindow();
if (window && (!window->GetPrivacyMode() || IsPrivateDataAllowed()))
{
const uni_char* url = window->GetCurrentURL().GetAttribute(URL::KUniName_With_Fragment, URL::KNoRedirect).CStr();
if (!url || !*url) // if nothing is currently loaded then try if something is loading.
url = window->GetCurrentLoadingURL().GetAttribute(URL::KUniName_With_Fragment, URL::KNoRedirect).CStr();
DOMSetString(value, url);
}
return GET_SUCCESS;
}
case OP_ATOM_readyState:
{
Window* window = GetTabWindow();
if (window && (!window->GetPrivacyMode() || IsPrivateDataAllowed()))
DOM_Document::GetDocumentReadiness(value, window->GetCurrentDoc());
return GET_SUCCESS;
}
#ifdef USE_SPDY
case OP_ATOM_loadedWithSPDY:
{
Window* window = GetTabWindow();
if (window && (!window->GetPrivacyMode() || IsPrivateDataAllowed()))
DOMSetBoolean(value, window->GetCurrentURL().GetAttribute(URL::KLoadedWithSpdy));
return GET_SUCCESS;
}
#endif // USE_SPDY
case OP_ATOM_port:
DOMSetObject(value, GetPort());
return GET_SUCCESS;
default:
return DOM_Object::GetName(property_name, value, origining_runtime);
}
}
示例2: GetTabWindow
ES_GetState
DOM_BrowserTab::GetTabInfo(OpAtom property_name, ES_Value* value, ES_Runtime* origining_runtime, ES_Object* restart_object)
{
if (!value)
return GET_SUCCESS;
// Private mode can be obtained synchronously if we have window.
if (property_name == OP_ATOM_private)
{
Window* window = GetTabWindow();
if (window)
{
DOMSetBoolean(value, window->GetPrivacyMode());
return GET_SUCCESS;
}
}
OP_ASSERT(GetTabId());
DOM_TabsApiHelper* call_helper;
if (!restart_object)
{
GET_FAILED_IF_ERROR(DOM_TabsApiHelper::Make(call_helper, static_cast<DOM_Runtime*>(origining_runtime)));
call_helper->QueryTab(GetTabId());
}
else
call_helper = DOM_HOSTOBJECT(restart_object, DOM_TabsApiHelper);
if (call_helper->IsFinished())
{
if (property_name == OP_ATOM_closed)
{
DOMSetBoolean(value, OpStatus::IsError(call_helper->GetStatus()));
return GET_SUCCESS;
}
else
GET_FAILED_IF_ERROR(call_helper->GetStatus());
switch (property_name)
{
case OP_ATOM_browserWindow:
DOM_BrowserWindow* new_win;
GET_FAILED_IF_ERROR(DOM_TabApiCache::GetOrCreateWindow(new_win, m_extension_support, call_helper->GetResult().value.query_tab.browser_window_id, GetRuntime()));
DOMSetObject(value, new_win);
break;
case OP_ATOM_locked:
DOMSetBoolean(value, call_helper->GetResult().value.query_tab.is_locked);
break;
case OP_ATOM_position:
DOMSetNumber(value, call_helper->GetResult().value.query_tab.position);
break;
case OP_ATOM_tabGroup:
if (call_helper->GetResult().value.query_tab.tab_group_id == 0)
DOMSetNull(value);
else
{
DOM_BrowserTabGroup* tab_group;
GET_FAILED_IF_ERROR(DOM_TabApiCache::GetOrCreateTabGroup(tab_group, m_extension_support, call_helper->GetResult().value.query_tab.tab_group_id, GetRuntime()));
DOMSetObject(value, tab_group);
}
break;
case OP_ATOM_focused:
case OP_ATOM_selected:
DOMSetBoolean(value, call_helper->GetResult().value.query_tab.is_selected);
break;
case OP_ATOM_title:
if (!call_helper->GetResult().value.query_tab.is_private || IsPrivateDataAllowed())
{
TempBuffer* tmp = GetEmptyTempBuf();
GET_FAILED_IF_ERROR(tmp->Append(call_helper->GetResult().value.query_tab.title));
DOMSetString(value, tmp);
}
return GET_SUCCESS;
case OP_ATOM_private:
DOMSetBoolean(value, call_helper->GetResult().value.query_tab.is_private);
return GET_SUCCESS;
default:
OP_ASSERT(!"Unexpected property");
}
return GET_SUCCESS;
}
else
return call_helper->BlockGet(value, origining_runtime);
}